Arduino servo & blinking LEDs

Your goal is to create a circuit that combines a servo and and two LEDs.  Imagine that you are building and automatic door.  The green light means that it is safe – the blinking read light means that the motor (servo) is opening the door.

Click here to learn how to rename and share your completed code

The outline for the code is below.

You have already made blinking LEDs programs and a servo program.  Remember that when you are combining two programs YOU ONLY NEED ONE void setup() and one void (loop) function.  

Video help 
Servo and blinking LEDs assignment description

How to duplicate a tinkercad circuit to reuse it for another project

How to wire an LED

How to wire and program a standard servo (don’t use the continuous servo – Tinkercad doesn’t offer those)

Here’s a full copy of the code and the circuit. 

  1. start with a delay of 2000 -this gives the servo time to wake up (initialize).
  2. green light on.
  3. wait two seconds.
  4. green light off.
  5. wait half a second.
  6. red light on.
  7. wait half a second.
  8. red light off.
  9. wait half a second.
  10. move servo to zero degrees.
  11. wait half a second.
  12. red light on.
  13. wait half a second.
  14. red light off.
  15. wait half a second.
  16. move servo to to 180 degrees.
  17. wait on second.