hello. my project is such- i have a flat surface fitted with sensors and i need to move the surface with the help of the servo such that the sensor reading gives me zero value. however when i run the following codes, the servo does not stop at the condition when sensor is zero. for example if i have sensor greater than reference (0), the servo performs the task well of decreasing the value of the sensor but instead of stopping at sensor=zero it keeps moving in the same direction hence incrementing the sensor in the negative direction. what is wrong with my codes please?
thanks for the reply. infact my main problem is that for each increase or decrease in the servo position, i constantly need to check the V_strain from the analog input pin until the condition is satisfied. another problem with the codes i am using is that i may cross the reference my incrementing the servo position by 10us, that is the reference may never be reached. I do not know very well how to put all these in codes since c++ is very new to me. Thanks for any help!