Table of Contents
- Assemble the Parts
- Configure the Radio
- Wire up the Circuit
- View it!
- Use it!
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.
2) Assemble the Parts
To hook up the push button example you'll need:
3) Configure the Radio
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.
- Log in to Device Cloud.
- Select Devices under the Device Management tab.
- Select the XBee Wi-Fi that you are configuring, then select Properties or double-click to open the Properties window for that device.
- Select Configurations, then Input and Output Settings, then confirm that DIO4/SPI_MOSI is set to Digital Input.
- On the same page, confirm that Sample Rate is set to 5000 ms which will take a sample every five seconds.
- Save your changes!
6) Use it!
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!