Search
Sensor detection part 2
- Tey Zhi Yong
- Feb 15, 2017
- 1 min read
To solve the erratic readings problem, I have added a timeout parameter in the sensor calibration code as shown below.

By adding the 17000 μs timeout parameter, I managed to restrict the sensor distance range up to 290 cm, anything further than that will give me a preset value of 999 cm, thus indicating a data error by showing the preset data in the serial monitor. This has helped in mitigating the erratic readings problem I faced earlier and the results are shown as below.

Comments