Exercise 16: Interface and Application Programming

Formata Arduino and Processing

Processing is a program that enables coding within a more visual environment, click here to learn more and view tutorials on processing. There are also many good tutorials I looked at click here . The most important thing to know is that to get Processing to work with a microcontroller a Firmata sketch must be run. Frimata is an Arduino sketch that enables software on a computer to communicate with host computers. The standard firmata is an example code in Arduino that can be used with Processing to control a microprocessor. It uses the I2C library and the standard Firmata sketch can also be used to run servos.

One of the first things I learned was that Firmata and Processing program does not work with ATtiny chips. My lab Partner David started out trying to use a board with an ATtiny and got an "TOTAL_PINS' was not declared in the scope" error. It turns out that Firmata uses a Total pin code which identifies all the pins automatically so they only need to be specified within processing. This means Firmata requires the use of ATmega328 chip as found on an Arduino. As such I moved directly to using the Arduino clone that I made.

First I downloaded Processing click here and downloaded the firmatata Library click here .

I then loaded the standard Firmata to the Ardiuno.

I then uploaded the Standard Firmata code to the my satshatkit Arduino using a FTDI basic.

Using the Processing code

My lab partner David was using the Arduino PWM Code (PWM=pulse wave modulation) and was manipulating the lights along the X axis. He shared the code with me and I changed it so that the lights flickered along the Y axis when the cursor moved across the grey box. These changes can be seen in lines 56 and 57 of the code.

The next thing I did was set a up my Arduino with a bread board and led lights along with the jumper cables to a FTDI basic. I hooked up pins 5 and 6 on the Satshakit arduino and ran them into the bread board along with 220 ohm resistors.

To download the code processing file (click here).

Conclusions

I think that processing a good platform for working with microprocessors. Serial output is not a very good way of viewing data and so the use of Processing it huge improvement so that output is presented in a meaningful way. I have to believe there is a way to get Processing to work with ATtinys and it is something I will investigate more in the future.