I have C code controlling a servo which gets its position command over serial.
It works well, 'cept for one thing, the position goes from 0 - 1440, if I'm on position 1440 and the servo gets a position 0 command, it wants to go forwards all the way around to 1440 instead of back 1.
My code runs other stuff so it needs to be non blocking, I can make it work if I take a value and then force the servo to that position ignoring all other commands meantime, but I want the servo to try and go to the latest position command, ie if the servo is still moving itself to a position and it gets a new position command I want it to abandon the last and go towards the latest command.