We recently had our annual app-building competition, Clash of the Coders. It’s a fantastic opportunity for us nerds to experiment with unfamiliar technologies, stretching ourselves and our tools. It’s all about learning, a fundamental value of Big Nerd Ranch. After an intense 72-hour coding marathon, our team (The Artists Formally Known As (╯°□°)╯︵ ɥsɐןɔ, yep) came out with an online, multiplayer game equipped with clients crossing four platforms: iOS, Android, Web… and Arduino!
Our project was a great opportunity to get familiar with hardware. Thanks to the kindness of fellow nerd Chae O’Keefe, we had plenty of Arduino hardware and the brilliant idea to incorporate individually addressable NeoPixels, maximizing the aesthetic of our physical client 😄.
Eventually, we settled on using Artoo, a robotics framework written in Ruby, to communicate with the Arduino. We chose it because of our familiarity with Ruby (and by the time we got around to working on the Arduino client there was only seven hours left in the competition).
Unfortunately, we quickly hit a showstopper. Artoo communicates with Arduino hardware using the Firmata protocol. Firmata doesn’t have support built in for NeoPixels.
So the adventure began…
In the early hours of the last day of our competition, we began peeling back the layers of software used to communicate between Artoo and Firmata. We quickly figured out that communication with Firmata is done with specially formatted serial messages containing command bytes. These bytes indicate the purpose of the message, such as a write to a digital pin.
Thankfully, the Firmata designers had the forethought to consider others’ desires to extend the protocol. This is accomplished via SysEx messages, interestingly part of the MIDI standard. By defining custom SysEx commands, we were able to send special messages to Firmata which were received, triggering routines to setup and control NeoPixels!
We had an absolute blast this year! If you’re interested in the nitty gritty details, check out my upcoming post, out next week. And don’t forget to show us what you make in the comments below!
Interested in learning more about our basic and advanced Back-End Courses?
Learn from the experts at a Big Nerd Ranch Bootcamp!
Interested in leveling up your coding skills from the same authors of the Big Nerd Ranch Guide? Subscribe to The Frontier today!
Charles Brian Quinn