week 15
- interface and application programming
- Assignment: write an application that interfaces with an input &/or output devices
As we have seen, programming with Arduiono IDE, it is possible to monitor, through serial communication, to view whats happening on the board.
Whether it is about input sensor or actuators or leds or other output devices, Arduino let us only read.
In this week we are learning Processing.
The IDE is very similar to arduino’s one and also regarding the syntax, it is always a C code derivation.
Processing allows to read and write. You can create a window where the infos coming from the board are showed just as your fantasy arrives.
Furthermore, it is possible to communicate in both ways giving commands from your keyboard to the device.
First step is to write a code for the board on Arduino’s IDE.
I choose as board my Eco Hello-world board provided with a button on Pin 2 and a led on Pin 3.
The code is simple and just lights up the led and serial prints “on” on the monitor when the button is pressed.
Then I inported the sample from our tutor Guillem where it explains both the codes for Arduino and Processing.
As my Echo board tiny 44 has a limited space for storing code (4.000 bytes), I had to cut a lot from the sample on Arduino.
I just set 3 command letters: a, b, c. The first to Led it on, the second to blink and the third to set off.
On Processing, after settin “7” as serial port, I simplified the code to save room on the Attiny, so instead of a command with a variable, I just used the Keyboard to send commands to arduino. I found a sample for settinng keyboard as input commands.
It worked perfectly.