BREAK LIGHTS

This project was made to help the little kids. They don't have autonomy to know what time their break finish and when they need to go back to the classroom. So, we decided to create the "break lights".

The little kids have a break of 50 minutes. In the first 45 minutes, a green light is on and in the last five minutes, the green turns off and a yellow light turns on (for them to know it's time to go to the toilet or drink some water and then go to the classroom).

We got the reference from this website:
https://www.makeuseof.com/tag/arduino-traffic-ligh...

I liked to make this project, even though it was very difficult to make it work. But, in my opinion, the result was really great!

Step 1: MATERIALS YOU NEED

To make this project, you will need:

- two leds (one yellow and one green) 5mm

- one arduino

- one button

- three resistors

- nine jumper wires

- one bread board

- one blue cable (that can connect your computer to the arduino)

Step 2: THE CODE

Write down this code on the Arduino (it can be the app or the website):

int yellow = 9;
int green = 8; 
int button = 12; // switch is on pin 12

void setup(){
pinMode(yellow, OUTPUT);
pinMode(green, OUTPUT); 
pinMode(button, INPUT); 
digitalWrite(green, HIGH);
pinMode(yellow, OUTPUT);
pinMode(green, OUTPUT); 
}

void loop(){
if (digitalRead(button) == HIGH){
delay(15); // software debounce
if (digitalRead(button) == HIGH) {
// if the switch is HIGH, ie. pushed down - change the lights!
changeLights();
//delay(15000); // wait for 15 seconds
    }
  }
}

void changeLights(){
// green off, yellow on for 3 seconds
digitalWrite(green, LOW);
digitalWrite(yellow, HIGH);
delay(3000);

// turn off green, then turn yellow on for 5 seconds
digitalWrite(yellow, HIGH);
digitalWrite(green, LOW);
delay(500);

// green and yellow on for 2 seconds (yellow is already on though) 
digitalWrite(green, HIGH);
delay(200);

// turn off yellow, then turn on green
digitalWrite(yellow, LOW);
digitalWrite(green, HIGH);
delay(300);
}

Step 3: MAKING IT WORK

You need to connect everything and in the end it need to look exactly like this image. After that, connect the arduino and your computer with the code using the blue cable.

Then, it's done!!!

Thanks for reading, hope you enjoy it! :)

Share

    Recommendations

    • Toys Contest

      Toys Contest
    • Big and Small Contest

      Big and Small Contest
    • First Time Author

      First Time Author

    Discussions