This excerpt doesn't include the sensor reading code. So you either already found a solution for your problem or you have to post the complete code to enable us to find the problem.
This excerpt doesn't include the sensor reading code. So you either already found a solution for your problem or you have to post the complete code to enable us to find the problem.