Zigroller project, software

As I promised the hardware section, I've now written up the software side of the Zigroller. This is mostly going to be a big block of text with some code snippets thrown in for flavor. I'm going to avoid going too deeply into the math, but I can't completely avoid it. The code is a bit of a mess right now, and there are a number of things that are in there because of the somewhat meandering route I took to this point and because it remains a work in progress.

ZigduinoRadio

Frank Zhao has release ZigduinoRadio, a radio library based on uracoli for the Zigduino. Its interface bears a strong resemblance to both the Wire library and the Serial class in the Arduino core. As a result, it is the easiest method for users to get bytes moving over the air. As a result, it lacks more sophisticated networking features. However, such features are unnecessary for using Zigduinos for tasks such as remote control and as the equivalent of wireless serial cables. 

Basic use of the library is about as straightforward as communication libraries get:

  • ZigduinoRadio.begin(<channel>) starts the radio on the given <channel>.
  • ZigduinoRadio.beginTransmission() opens a transmission.
  • ZigduinoRadio.write(<byte>) one or more times appends <byte> to the outgoing frame.
  • ZigduinoRadio.endTransmission() sends the frame built up by the calls to ZigduinoRadio.write().
  • ZigduinoRadio.available() checks whether any bytes are available.
  • ZigduinoRadio.read() retrieves a byte from the receive buffer.

And that's all that's required to send and receive bytes. There are a number of other useful features, in particular a nice event model that allows you to define callback functions for various things such as on receipt of a message, on completion of a transmission, on error, etc. Naturally, a variety of radio diagnostics derived from uracoli are also available.