Wiring and code for fast vibration switch with Photon

Hi all,

I just purchased the Photon and I’ve completed the 4 tutorials. I’ve now purchased a fast vibration switch from Adafruit. The device has two wires attached. Does anybody have the code that will compile on the IDE platform and a photo for how to wire this device to the bread board? Once it writes to the Particle Console I can take it from there. Thank you!

Links to the Adafruit page and a look at the usually present code and wiring diagrams would help :wink:

And for wiring, the clue might be found in this paragraph of the Adafruit description

No rocket science there :wink:


Ahh yes they usually do but NOT for this “vibration sensor”. They sell 3 different versions and none of them have the photo of the wired bread board or the code. I successfully did the 4 tutorials so I CAN follow directions but I’m not good enough to make the leap with this sensor.

Adafruit had a great photo of the bread board and the code for an IR break beam sensor that I also bought. That code successfully compiled which was lucky but the code lacked the lines that write to the Particle Console. In addition, their photo of the breadboard was different than the Photon breadboard so I wasn’t sure that I had the signal wire in the correct holes. So I couldn’t get that break beam sensor to work and I think I had both the wiring and the code wrong but I may never know at this rate.

I’m an amateur PHP, HTML and SQL coder in addition to welder so I’m “handy” but the Photon is beating me. In lieu of my request, how about a link helping me with the IDE programming language and a link explaining how to wire a breadboard. I’m not certain if the signal wire needs to be in the same “row” as the power line etc.

Thanks again.

1 Like

They have some sample implementations in the LEARN section right there

And since that vubration switch is noting other than a switch, you’d wire it like any old switch (one pin to GND the other to a GPIO pin), set the pinMode(yourPin, INPUT_PULLUP) and digitaRead(yourPin) or use attachInterrupt(yourPin, yourISR, FALLING).