
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
10/23
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
data = (double) val * (5/10.24); // convert the voltage to temperture
if(data>27){ // If the temperture is over 27 degree, buzzer will alarm.
for(int
x=0; x<180; x++){
sinVal = (sin(x*(3.1412/180)));
toneVal = 2000+(int(sinVal*1000));
tone(8, toneVal);
delay(2);
}
} else
{ // If the temperturn is below 27 degree, buzzer will not alarm
noTone(8);
}
if(millis() ‐ tepTimer > 500){ // output the temperture value per 500ms
tepTimer = millis();
Serial.print("temperature: ");
Serial.print(data);
Serial.println("C");
}
}
8.Detecting vibration
?