A button or "momentary switch" is perfect for projects that require user input, or any place you need to detect a change in device state. This example uses a simple tactile switch however the very same circuit can be used with a pressure mat to detect someone walking into a room, or with a microswitch to monitor when a door opens or with a passive infrared sensor to respond to motion. In this tutorial, we’ll walk you through wiring up a simple button to your XBee Wi-Fi so that its current state can be seen in a online application from anywhere in the world.
To hook up the push button example you'll need:
You'll configure the radio using your free Device Cloud account. (Note that radios can also be configured using XCTU.)
NOTE: If your radio was recently configured by the XBee Wi-Fi Cloud Kit then the sampling rate and pin settings are already set. You can safely skip these steps.
You will build this sensor circuit using the XBee Development Board.
You will use the XBee Wi-Fi Cloud Kit's web application to configure a widget for viewing the push button's state from the web.
It's time to push your button! Press down on the physical push button to see the onscreen widget move from OFF to ON. Let go and it should pop back to OFF. Congratulations, your real world actions are now changing the Internet!
Try wiring up different switches to monitor motion in the office, detect if anyone is opening your desk drawers or watch to see if there's a car parked in your spot. While there's plenty of analog sensors for monitoring weight, light, angle, pressure, or proximity, there's almost always a way for a digital switch to fill the same shoes at lower cost and with greater reliability. When in doubt, try a switch!