25/06/2015
DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki
http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100
4/23
36
37
38
39
40
delay(100);
}
delay(5000);
}
3.Traffic Light
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
Traffic Light
This code copied from the book Beginning‐Arduino.
*/
int
carRed = 12; //assign the car lights
int
carYellow = 11;
int
carGreen = 10;
int
button = 9; //button pin
int
pedRed = 8; //assign the pedestrian lights
int
pedGreen = 7;
int
crossTime =5000; //time for pedestrian to cross
unsigned long
changeTime;//time since button pressed
void
setup() {
pinMode(carRed, OUTPUT);