Instructions

25/06/2015 DFRduinoBeginnerKitForArduinoV3SKU:DFR0100RobotWiki
http://www.dfrobot.com/wiki/index.php/DFRduino_Beginner_Kit_For_Arduino_V3_SKU:DFR0100 11/23
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
Detectingvibration
*/
intSensorLED=13;//LEDPIN
intSensorINPUT=3;//ConnectthesensortodigitalPin3whichisInterrupts1
unsignedcharstate=0;
voidsetup(){
pinMode(SensorLED,OUTPUT);
pinMode(SensorINPUT,INPUT);
//Triggertheblinkfunctionwhenthefallingedgeisdetected
attachInterrupt(1,blink,RISING);
}
voidloop(){
if(state!=0){
state=0;
digitalWrite(SensorLED,HIGH);
delay(500);
}
else
digitalWrite(SensorLED,LOW);
}
voidblink(){//Interruptsfunction
state++;
}
9.AmbientLightcontrolledLED