I have a question concerning a project I've been working on. I have a Servo motor starting at angle 0 then delaying one second and going to angle 160, delaying one second and going back to 0. What I want to do is once it reaches 160 degrees to turn on a LED. And when it goes back down to 0, turn off the led. This is what I have so far.
After you set the angle to 160 degrees (and before the delay) turn the led on.
And after you set the angle back to 0 degrees, turn the led off.
Can you do that ? Give it a try.
You can copy-paste your sketch between code tags, use the '#'-button (above the text field when you type a reply).
If the led lights up before completing the rotation, note the time it takes to complete the rotation and add that much delay before digital writing led.
Please copy-paste your sketch between code tags, use the '#'-button (above the text field when you type a reply).