When at work I wonder if my dog was getting walked on the 12 or so hour days and often rely on roommates and friends to take her out to send Dog Pee-mails. So when the leash is grabbed off the hook reads that nothing is hanging from it, after the walk is over and leash is returned it automatically sends an e-mail that says dog has been walked.
Step 1: Setting Up the Circuit
This Simply circuit that current will flow through the lower-resistance paths. You might of herd people say "electricity takes the path of least resistance," they're discussing a circumstance where the paths differ dramatically in resistance, such as a wet hand vs. an air gap. A switch provides this air gap and as the current will flow between D0 through the 221 Ohm resistor to D5 When the switch between D0 and ground is open. When the switch is shut and because the 221 Ohm resister is much higher resistance than practically all the current will flow through the switch that has close to 0 Ohms.
Hook a Wire from GND to the leg of your switch.
Hook other leg of the switch to D0
Put the 221 Ohm resistor between D0 and D5
Step 2: Particle Code and PushingBox Setup
Download the file below and open it up in Notepad++ or what ever you use to open text files.
You will need to set up PushingBox for this to work and will need a DeviceID code that is separate from your Spark/particle board ID and this ID needs to be entered into the code on line 33. see top of code for more info.
Go to : https://www.pushingbox.com/
Login with google account
Go to MyServices .. Add Service .. Choose service you prefer Then go to MyScenarios ..
Enter a name and add scenario .. Add action .. Select service you prefer .. Submit information
Then copy the DeviceID provided by PushingBox and place into the code provided.
Code: Code is attached in the text file. If it is flashed to the core and it starts flashing red just give it time to reconnect to the network and it should work.
Step 3: Switch and Hook Setup
Now comes a little creativity.
I used stuff laying around the shop but really you just need a switch that when down force is applied the switch is pressed.
90 degree 18-Gauge Roof Truss Clip
90 degree angle bracket
Spring loaded switch