Hi all, I'm working on the code posted here ("Topic: Thumbstick (Joystick) and 2 Servos"):
http://forum.arduino.cc/index.php?topic=358589.0
There is a section in which, when the Joystick is on resting position, an LED turn on.
However, the problem is that the central position of the Joystick is almost NEVER "1500" (perfect middle), so the LED actually never turn ON (well, sometimes it does but for a fraction of a second).
How can I add a "+/- 10 (for example) tolerance" to this piece of code?
if (servoPosition[servoIndex] != startPosition[servoIndex])
{
digitalWrite(SERVOS_HOME_LED_PIN, HIGH);
}
else
{
digitalWrite(SERVOS_HOME_LED_PIN, LOW);
}
(Whole code on the appropriate topic page)