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
7/23
30
31
32
33
34
35
36
37
void
fadeOff(unsigned int
time,int
decreament){
//change the brightness by FOR statement
for
(byte value = 255; value >0; value‐=decreament){
Serial.println(value);
analogWrite(ledPin, value);
delay(time/(255/5));
}
}
5.RGB LED
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*
RGB LED
*/
int
redPin = 9; // the pin that the red LED is attached to
int
greenPin = 10; // the pin that the green LED is attached to
int
bluePin = 11; // the pin that the blue LED is attached to
void
setup(){
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void
loop(){