Having some time to myself to play with some new sensor, the circuit is pretty straight forward, waiting for my raspberry pi in the meantime..
Sensor
VCC >> 5V
GND >> GND
OUT >> pin 3
/* Crash Collision Sensor Detection Module
*
*/
int ledPin = 13; // choose the pin for the LED
int inputPin = 3; // connect sensor to input pin 3
int count = 0;
void setup() {
Serial.begin(9600); // Init the serial port
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inputPin, INPUT); // declare Micro switch as input
}
void loop(){
int val = digitalRead(inputPin); // read input value
if (val == HIGH) { // check if the input is HIGH
digitalWrite(ledPin, LOW); // turn LED OFF
} else {
digitalWrite(ledPin, HIGH); // turn LED ON
count += 1;
Serial.println(count);
Serial.println("Switch Pressed!");
}
delay(80); // the higher the delay the less sensitive the switch
}