Introduction: Break Lights
MAKERSPACE & CODING S6
What is it:
Our project is a system of lights that help the little kids to control their time without a bell sound or someone to help them.
How it works:
The kids have about 50 minutes of break. In the first 45 minutes of their break the green light will be on and in the last 5 minutes of break the yellow light will turn on and the green off, southey know they should go to their classroom without getting late. that way they will just look at the lights and be able to manage their schedule, that way they will get more responsible
Step 1: Step 1- Materials & How to Make It:
Materials used:
resistors(3)
wires (9)
button (1)
yellow led 5mm (1)
green led 5mm (1)
breadboard
arduino
How to make it:
first you need to write the code (written on step 2) using arduino on a computer:
Step 2: Step 2- the Code
CODE:
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);
}
Then verify it and make sure everything is right then, connect the resistors, the LEDS, the button to the bread board and the wires to the bread board and/or the arduino in the right position.
Step 3: Step 3- References & Opinion
Opinion:
In my opinion it was a good experience because i was able to learn more about arduino and codes, but i still think we can always improve!
References: