Creating a standalone relay
In addition to reading the input pins remotely, you can also control them remotely. All the XBee modules support a digital output (low/high) and some also support PWM output (pulse width modulation, as used by analogWrite
in Arduino).
This section shows how to use a digital output pin to control a relay, letting you make a simpler version of the remote relay that you saw in Chapter 4, Controlling the World. Obviously, the wiring will be different as there is no Arduino involved anymore. The coordinator sketch will also need some modifications as the XBee module needs a different kind of a message to change its output pin.
When using the recommended hardware items, this example should look as follows:
Connecting things ...
Get Building Wireless Sensor Networks Using Arduino now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.