<

11

interface + application programming

This week, I decided to make an application interface that would communicate with my fabduino + color OLED display and perhaps render some artwork.

I used Javascript as my language of choice, because that would maximize the fluidity between both the client and server side code. I learned that there's a protocol called firmata that lets you "remote control" the Arduino IDE by translating Javascript into C++. Pretty neat!

Browsing existing work, I came across several node libraries came in handy. One was Johnny-five and another was oled-js. NPM install we go!

In order to communicate between the client and the node server, I also used express and socket.io, which lets you communicate pretty seamlessly between the two sides and is bidirectional.

I first started by tackling the board, making sure that node was speaking with my setup. I'm having some issues with my fabduino at the moment, so I ended up using an arduino board. There's a difference between SPI and I2C protocols, FYI!

The second issue was that the library was only for monochrome OLEDs and mine is in color. So basically I couldn't use any of the functions that were available, except for basic turning on and off the OLED.

In order to move on with this week's assignment, I used to two functions that did work: turn on/off as a placeholder. On the client side, I made a form field where the user could type "ON" of "OFF" and then have that passed to the server using websockets.

The last piece was testing it and putting it together. I was able to successfully connect the input from the form field, receive it as a variable in node.js, and then update the board using the firmata library.

Next week I will continue digging into the code to understand how to add support for 16-bit color OLED displays.