App and hardware interaction
I am going to use a potentiometer as an input, convert the analog signal in digital, map the ditital information on the chip, send it to the computer, and control graphical parameters with it. First, we set the hardware. Here is a simple potentiomenter layout.
When we move the potentiomenter, the Processing program receive it and shows the bar with a short length and a dark color.
If we move the potentiometer to the center, we see a change in lenght, darkness and color, as programmed.
When the potentiomenter is set to the other side, the bar is at the longest size, and the color is bright red.
Then I tried the application in the board I made for the final project. The files for this board can be found in the page Final Project.
The programming process and logic are descibed in detal in the comments inside de .ino and .pde. Basically, the board communicates with the computer Serially, and uses the data to change the values of some variables in the programm, like the size and the color of the bar. Processing is a Turing-complete programm, so the information can be used in virtual any algorithm. However, Processing is foccused on graphics, so If we need something more sophisticated, we might need to use Python or C, and then render the graphics in Processing.
The upload was done as it the board where an Arduino UNO. It has the same chip (Atmega328), and the same crystal (16Mhz), so it recognizes it as it were the UNO. Moreover, we can use all the Arduino libraries.
Here are the files to download: Inicial program prototype, Second program prototype, fabKitModified (skematic), fabKitModified (board), initial test (board), working interfase (board), initial test (Processing in a PC), working interfase (Processing in a PC).