
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
8/23
15
16
17
18
19
20
21
22
23
24
// call the function to change the colors of LED randomly.
colorRGB(random(0,255),random(0,255),random(0,255)); //R:0‐255 G:0‐255 B:0‐255
delay(1000);
}
void
colorRGB(int
red, int
green, int
blue){
analogWrite(redPin,constrain(red,0,255));
analogWrite(greenPin,constrain(green,0,255));
analogWrite(bluePin,constrain(blue,0,255));
}
6.Alarm
?
1
2
3
4
5
6
7
8
9
10
11
12
13
/*
Alarm
*/
float
sinVal;
int
toneVal;
void
setup(){
pinMode(8, OUTPUT);
}
void
loop(){
for(int
x=0; x<180; x++){
// convert degrees to radians then obtain value