I am trying to be able to control a servos movement with millis and without delay. I tried combining the "sweep" sketch and the "blinkwithoutdelay" sketch but for some reason that doesnt work.
Any idea on why this doesn't work? Any help is appreciated.
I cant add a delay, I would like to keep the rest of the code running while the servo sweeps because the rest of the code contains leds that are time sensitive and are in sync with music. Is there any other way to control a servos position and speed without using delay?
I cant add a delay, I would like to keep the rest of the code running while the servo sweeps because the rest of the code contains leds that are time sensitive and are in sync with music. Is there any other way to control a servos position and speed without using delay?
Try it, just to see what happens.
You can take them out later or use mills() to replace them (see blink without delay examples).
Your program runs the code within the IF statement at 15 millisec intervals. But within that IF statement you try to move the servo all the way left and then all the way right (or vice versa) - all within 15 millisecs?
Your program needs to be redesigned so that within the IF statement it only moves the servo a single step on the way between 0 and 180 or between 180 and 0.