added pollSensor() function