XBee Configuration - OSC
[OSC]
Configure an XBee module connected to your Make Controller Kit via OSC.
More...
Configure an XBee module connected to your Make Controller Kit via OSC.
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 Config OSC messages.
The XBee Config system has the following properties:
- write
- get-message
- packet-mode
- samplerate
- address
- panid
- channel
- at-command
- io
- active
Reading values from the XBee Config system is a bit different than the other systems. Because we need to see any messages that arrive at the XBee module and not just the one we're requesting at a given moment, to get any message back you need to use the get-message property. Imagine the case where we want to ask the module its address, but another module is busy sending us sensor values. If we waited for the address message, we'd miss all the sensor values.
So to read a value, first send the request then call get-message until you get the response you're looking for. If you have autosend turned on, it will get messages for you, so you just need to send the request - this is much easier.
- Write
- When you change any of the paramters of your XBee module, it will by default revert back to its previous settings when it gets powered down. The write property sets the current values (all of them) into memory.
- For example, to set the sample rate to 100 milliseconds, and save it permanently, send the messages
/xbeeconfig/samplerate 100
/xbeeconfig/write 1
- Get Message
- The get-message property fetches the most recent message received by the XBee module. If you have autosend turned on, you don't need to use get-message and, in fact, it won't have any effect. To get a message from your XBee module, send the message and the board will send one back if there were any available.
- Sample Rate
- The samplerate property corresponds to how often the XBee module will sample its IO pins and send a message with those values. If it's set to 0, the module will not sample its IO pins. The maximum sample rate is 65535. When the sample rate is set very low, the XBee module cannot guarantee that it will be able to keep up with all the samples requested of it.
- To set the sample rate to once a second (every 1000 milliseconds), send the message
/xbeeconfig/samplerate 1000
To read the sample rate, send the message
- Address
- The address property corresponds to the address of the XBee module. Valid ranges for the address are from 0 - 65535.
- To set the address to 1234, send the message To read the address, send the message
- Channel
- The channel property corresponds to the channel of the XBee module. Valid ranges for the address are from 11 - 26 for XBee modules and 12 - 23 for XBee Pro modules.
- To set the channel to 15, send the message To read the channel, send the message
- AT Command
- The at-command property allows you to read/write AT commands to your XBee module via OSC. The most common commands are included - samplerate, channel, address, etc. but this is helpful if you need to send any of the other commands to your module. To write a command, specify the 2-letter command and then the value to set. To enable encryption, for example, send the message
/xbeeconfig/at-command EE 1
- To read a value back via an AT command, simply send the 2-letter command you'd like to get the value for. To read back the hardware version, send the message
/xbeeconfig/at-command HV
Check the XBee documentation for a complete list of commands the boards will respond to.
- PAN ID
- The panid property corresponds to the Personal Area Network ID of the XBee module. Valid ranges for the address are from 0 - 65535. The default value is 13106.
- To set the PAN ID to 512, send the message To read the PAN ID, send the message
- Input/Output Pins
- There are several io properties that allow you to configure each of the 9 IO pins on the XBee module. Pins can be set to one of 5 values:
- 0 - disabled
- 2 - analogin
- 3 - digital in
- 4 - digital out high
- 5 - digital out low
- There are 9 IO pins on the XBee module, numbered 0 - 8. Send messages to them by specifying io + their number. Pin 8 cannot be an analogin - it can only be a digital in or out. For example, to set IO 0 to analogin, send the message To set IO 6 to a digital in, send the message To read the configuration of pin 5, send the message
- 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
- You can set the active flag by sending