Gentlemen, no code to show here, question general. Have many sensors on hand, consider the SW18010P or any other. Can't seem to figure out by experiment the actual conditions that make it go back to yielding a LOW once a digitalRead has yielded a HIGH.
Can you change the pin to OUTPUT and set it to LOW, then change back to INPUT?
The SW18010P is just a switch.
A ballpoint spring as one contact, and a metal stick inside the spring as the second contact.
Not sure why you need a breakout board for that (second picture).
Just connect between an input pin and ground, with pull up enabled in pinMode.
Pin will be LOW (for a short time) when a shock is detected.
Make sure your loop is short, otherwise you will miss it.
Could use interrupts.
Leo..
chuck659:
Can't seem to figure out by experiment the actual conditions that make it go back to yielding a LOW once a digitalRead has yielded a HIGH.
You probably don't have it on a pin with an external pulldown resistor, which would take it low if it's not being made high by the sensor.
(But as Wawa points out, pullup is easier since they're built in. Need to reverse the logic though, since it will now be normally high, and active low.)