Introduction: Arduino Traffic Lights

Here is a project that makes traffic lights.

Supplies

FROM YOUR KIT:

1 x Arduino with Grove Shield

1 x USB-B (Arduino end) to USB-A (laptop end).

1 x USB-A to USB-C adaptor (if using a MAC with no USB-A port)

3 x Grove LEDs (one green, one yellow/orange, one red)

3 x Grove cables

6 x Rickets to hold Grove Modules down onto cardboard


BYO:

1 x Laptop with Arduino IDE software

1 x piece of cardboard

Step 1: Build the Circuit

Follow the following instructions to build the traffic light circuit.

Step 2: Code

The following code will get the traffic lights working.

//Add Libraries
#include "Led.h"

//Global Variables

//Create Objects
Led redLED(2);
Led amberLED(3);
Led greenLED(4);

//Setup
void setup() {
}

//Main Loop
void loop() {
 greenLED.on();
 amberLED.off();
 redLED.off();
 delay(3000);

 greenLED.off();
 amberLED.on();
 redLED.off();
 delay(1000);

 greenLED.off();
 amberLED.off();
 redLED.on();
 delay(3000);
}