FAB ACADEMY 2014 Interface and Application Programming
MAY07

This week assignment is about interface and application programming, so for this assignment I chose processing as programming language. Processing is not only a programming language, it's also a development enviroment wich can be downloaded here. Processing let's you build graphic user interfaces ranging from simple to complex, but most important is the support for custom libraries, for example there's been lot of support for kinnect, OpenCV, arduino, OSC. The interface I developed uses the serial communication for interfacing my version of Fabduino.



STUFF YOU NEED:

Fabduino
FTDI board or cable, I've fabricated my own FTDI board wich I'll be using for my final project also, eagle files here.
Touchpad Synaptics, check my Input Devices assignment for a "HOW TO"!
Arduino IDE
Processing IDE
And last but not least tons of patience while debugging!

The first thing in my program is the Serial library import wich I'll use to receive information from my Fabduino wich will be connected to my hacked touchpad. At this time i already got the sketch for interfacing the touchpad with the microcontroller, but I the hard task was to send the data with coordinates, wich are integer values, through serial from the Fabduino to processing. This wasn't so easy because for serial communication with processing i have to make a Serial.println() with the Fabduino, even when the data you write with serial is a byte or a char processing receives it as the result in DEC from the ASCII table for the current byte value. For example if you send the nibble a processing receives it as 65.

Another important thing the data with the coordinates are integer values I had to send as char because it's not so simple to read a string in processing, so I applied masks to every coordinate and splitted them as chars, and send them packed with an identifier at start and another for the end. This means that for every coordinate sent through serial I send 4 bytes of information. For example for X coordinate the data would be "01A08702" 01 and 02 are start and end bytes for X and it's different for every axis. Finally with the Arduino function "Serial.println()" you're adding extra bytes to the framing: "carriage return" and "new line" corresponding to 13 and 10 in DEC. I had a lot of work debuggin my app but in the end it was worth.



The graphic part of my app consists on some circles drawing like drops of water you have to collisionate anywhere inside the circle to clear them and realocate at a random location with a random color too. I've uploaded a video of it enjoy!



For Arduino source code you can download it here

For Processing source code you can download it here