
keyestudio
www.keyestudio.cc
17
digitalWrite(greenled, LOW); // turn off green LED
for(int i=0;i<3;i++)// blinks for 3 times
{
delay(500);// wait 0.5 second
digitalWrite(yellowled, HIGH);// turn on yellow LED
delay(500);// wait 0.5 second
digitalWrite(yellowled, LOW);// turn off yellow LED
}
delay(500);// wait 0.5 second
digitalWrite(redled, HIGH);// turn on red LED
delay(5000);// wait 5 second
digitalWrite(redled, LOW);// turn off red LED
}
//////////////////////////////////////////////////////////
Result
When the uploading process is completed, we can see traffic lights of our own design.
Note: this circuit design is very similar with the one in LED chase effect.
The green light will be on for 5 seconds, and then off., followed by the yellow light blinking for 3
times, and then the red light on for 5 seconds, forming a cycle. Cycle then repeats.
Experiment is now completed, thank you.
Содержание Basic starter kit
Страница 1: ...1 ...
Страница 10: ...keyestudio www keyestudio cc 8 Connection for 2560 R3 ...
Страница 17: ...keyestudio www keyestudio cc 15 Connection for 2560 R3 ...
Страница 21: ...keyestudio www keyestudio cc 19 Connection for 2560 R3 ...
Страница 25: ...keyestudio www keyestudio cc 23 Connection for 2560 R3 ...
Страница 29: ...keyestudio www keyestudio cc 27 Connection for 2560 R3 ...
Страница 39: ...keyestudio www keyestudio cc 37 Connection for 2560 R3 ...
Страница 43: ...keyestudio www keyestudio cc 41 Connect the sensor to analog pin 0 Connection for R3 Connection for 2560 R3 ...
Страница 62: ...keyestudio www keyestudio cc 60 Connection for 2560 R3 ...
Страница 66: ...keyestudio www keyestudio cc 64 Connection for 2560 R3 ...
Страница 77: ...keyestudio www keyestudio cc 75 Manual for LED segment display ...
Страница 78: ...keyestudio www keyestudio cc 76 Connection for R3 Connection for 2560 R3 ...
Страница 90: ...keyestudio www keyestudio cc 88 Connection for 2560 R3 ...
Страница 94: ...keyestudio www keyestudio cc 92 ...
Страница 95: ...keyestudio www keyestudio cc 93 Connection for R3 Connection for 2560 R3 ...