25/06/2015
17
data = (double) val * (5/10.24); // convert the voltage to temperture
18
19
if(data>27){ // If the temperture is over 27 degree, buzzer will alarm.
20
for(int
21
sinVal = (sin(x*(3.1412/180)));
22
toneVal = 2000+(int(sinVal*1000));
23
tone(8, toneVal);
24
delay(2);
25
}
26
} else
{ // If the temperturn is below 27 degree, buzzer will not alarm
27
noTone(8);
28
}
29
30
if(millis() ‐ tepTimer > 500){ // output the temperture value per 500ms
31
tepTimer = millis();
32
Serial.print("temperature: ");
33
Serial.print(data);
34
Serial.println("C");
35
}
36
}
8.Detecting vibration
?
http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100
DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Robot Wiki
x=0; x<180; x++){
10/23
Need help?
Do you have a question about the DFR0100 and is the answer not in the manual?
Questions and answers