Switching things using hexonoff
Clone this wiki locally
If you want to switch something on and off via Hexabus, you can simply use the hexonoff app:
1. Connect your devices to the Hexabusdevice
Simply hook up your devices between GND and one of the pins PA0 to PA7 on the Hexabusdevice. It is recommended to use optocouplers to do this.
2. Activate and configure Hexonoff
In hexabus/firmware/contiki-2.x/platform/Hexabus-Socket/apps/hexonoff/hexonoff.h only comment the
#define HEXONOFF_OUTx PAx corresponding to the pins you used.
Set HEXONOFF_ENABLE in firmware/contiki-2.x/platform/Hexabus-Socket/hexabus_config.h to 1 and HEXONOFF_INITIAL_VALUE to the outputs which should be set after boot. This has to be the decimal representation of an 8Bit value with the bits corresponding to the outputs set to 1. (e.g. outputs 1 and 3 on = 00000101 Binary = 5 Decimal)
3. Control your devices
Now you can send a value similar to the INITIAL_VALUE to EID 27 to set the outputs corresponding to the set bits or to EID 28 to toggle the outputs with the bits set.
Set outputs 2 and 3 to on and 4 to off: Send 00000110 = 6 to EID 27
Toggle outputs 5 and 1: Send 00010001 = 17 to EID 28