Blinker - Arduino tutorial

In this project we'll be creating a smaller version of a car blinker.

What you'll need for this to work is:

  • Arduino Uno
  • Breadboard
  • Breadboard wires
  • 4 LEDs
  • 4 resistors - 220 Ω
  • 3 pushbuttons
  • USB-B cable (or something else to power the Arduino)

Once you have all the components, connect them like this.

fritzing

The code is actually pretty simple. When pushbutton is pressed down, it sets the flag to 1 and turns on the lights in the order we've written down. Flag allows the blinker to repeat itself without us having to press the button. Once we press the third button, it stops the blinker. Take a look at the code below:

And that's it! It should be working now, but if it isn't, leave us a comment down below and we'll try to help you.