Experiment 1: Traffic Lights: Description of The Project
Experiment 1: Traffic Lights: Description of The Project
10/16/2019 1
Symbol of LED
10/16/2019 2
1
16/10/2019
10/16/2019 3
10/16/2019 4
2
16/10/2019
void loop() {
digitalWrite(redPin, HIGH); // turn the red light on
int ledDelay = 10000; // delay in between
delay(ledDelay); // wait 5 seconds
changes
digitalWrite(yellowPin, HIGH); // turn on yellow
int redPin = 10;
delay(2000); // wait 2 seconds
int yellowPin = 9;
digitalWrite(greenPin, HIGH); // turn green on
int greenPin = 8;
digitalWrite(redPin, LOW); // turn red off
void setup() {
digitalWrite(yellowPin, LOW); // turn yellow off
pinMode(redPin, OUTPUT);
delay(ledDelay); // wait ledDelay milliseconds
pinMode(yellowPin, OUTPUT);
digitalWrite(yellowPin, HIGH); // turn yellow on
pinMode(greenPin, OUTPUT);
digitalWrite(greenPin, LOW); // turn green off
}
delay(2000); // wait 2 seconds
digitalWrite(yellowPin, LOW); // turn yellow off
// now our loop repeats
}}
10/16/2019 5
10/16/2019 6