# XBee - OSC
[OSC]

Communicate with XBee modules with the Make Controller Kit via OSC. More...

Communicate with XBee modules with the Make Controller Kit via OSC.

## Devices

There can only be one XBee board connected to the Make Controller Kit's serial port at a time, so there is not a device index in XBee OSC messages.

## Properties

The XBee system has the following properties:

- autosend
- io16
- io64
- rx16
- rx64
- tx16
- tx64
- tx-status
- active

Autosend
  The autosend property corresponds to whether the Make Controller will automatically send out messages it receives from a connected XBee module. By default, this is turned off. To turn this on, send the message

      /xbee/autosend 1

  and to turn it off, send

      /xbee/autosend 0

  All autosend messages send at the same interval. You can set this interval, in milliseconds, by sending the message

      /system/autosend-interval 10

  so that messages will be sent every 10 milliseconds. This can be anywhere from 1 to 5000 milliseconds.

  You also need to select whether the board should send to you over USB or Ethernet. Send

      /system/autosend-usb 1

  to send via USB, and

      /system/autosend-udp 1

  to send via Ethernet. Via Ethernet, the board will send messages to the last address it received a message from.

io16
  The io16 property corresponds to an incoming message from an XBee module with samples from its IO pins. The best way to use this is to turn the XBee system's autosend property on - then the Make Controller can relay io16 messages as soon as they're received.

  Once you've turned on autosend, if there are boards on your network that are sending IO packets, you'll receive messages like

      /xbee/io16 1234 28 12 0 0 1023 1023 0 512 0 1023

  The first two numbers are:
  1. the address of the module that sent the message (1234 in the example above)
  2. signal strength (28 above)

  The next 9 numbers are the values from the 9 IO pins on the XBee module.

io64
  The io64 property corresponds to an incoming message from an XBee module with samples from its IO pins. This message is just like the io16 message, except it's coming from a board with a 64-bit address, rather than a 16-bit address. The structure of the message is the same (see above).

rx16
  The rx16 property corresponds to an incoming message from a 16-bit address XBee module with arbitrary data. The best way to use this is to turn the XBee system's autosend property on - then the Make Controller can relay rx16 messages as soon as they're received.

  Once you've turned on autosend, if there are boards on your network that are sending IO packets, you'll receive messages like

      /xbee/rx16 1234 28 0 [43 44 45 32 46 47 48]

  The first three numbers are:
  1. the address of the module that sent the message (1234 in the example above)
  2. signal strength (28 above)
  3. the options byte (0 above), respectively.

  Following those is an OSC blob with the data (enclosed in square brackets above). These are the hex values for each byte of data.

rx64
  The rx64 property corresponds to an incoming message from an XBee module with samples from its IO pins. This message is just like the io16 message, except it's coming from a board with a 64-bit address, rather than a 16-bit address. The structure of the message is the same (see above).

Transmit Status
  The tx-status property gives you the status of a previously sent message. It tells you the frameID of the message that was sent and its status, which can be one of:
  - Success. Message was successfully transmitted and received.
  - No acknowledgement received. The message was successfully sent, but not successfully received on the other end.
  - CCA Failure.
  - Purged.

  If you don't include a frameID for the message that you sent, a tx-status message will not be generated. An example tx-status message will look like

      /xbee/tx-status 52 Success

  where 52 is the frameID and "Success" is the status.

Active
  The active property corresponds to the active state of the XBee system. If you're not seeing appropriate responses to your messages to the XBee system, check whether it's active by sending the message

      /xbee/active

  You can set the active flag by sending

      /xbee/active 1