- No Libraries needed.
- No Advance knowledge needed.
- 1 x HDX2 Vibration Switch Sensor.
- 1 x Arduino UNO board with USB cable ( or Lakduino ).
- 2 x Male to Female Jumper Cables.
- ( 1 x LED bulb if you need. )
- Connect the jumper wire's female end to HDX2 Vibration Switch Sensor.
- Connect Male ends to Arduino's 3 (digital) and GND (ground) ends.
If You have a LED connect it's (+) to Arduino's 13th female end And (-) to Arduino's GND
OK.. you Done..
3. Copy This Code to Your Arduino IDE.
-----------------------------------------------------
int ledPin = 13;
int sensor = 3;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(sensor, INPUT);
}
void loop() {
if(digitalRead(sensor)==HIGH){
digitalWrite(ledPin, HIGH);
delay(1000);
}else{
digitalWrite(ledPin, LOW);
}
}
-----------------------------------------------------
4. Compile and Upload to Arduino.
You've Done !! ;)
The LED or (and) Arduino's 13th pin's LED will blink when HDX2 Vibration Switch Sensor can sens a Vibrate !
Good Luck..
Any Questions ?? Comment Below.. :)