example code for use with sensors