assignment 16

interface and application programming

16nd week

The aim for this week is work with some interface & application programming, using one of the boards that we milled in previous assignments.

I already started this assignment in the input devices week, so I decided to continue from there.


Processing + Serial

As I used an Attiny45 for the input board, I could´nt upload to it the firmata library for communicating it with Processing or other softwares, so I had to use the old Serial communication to achieve it; using the Serial.write() function.

I fixed this example, i wasn´t pasing the incoming values properly, thats because I only could receive values from 0 to 255. Now I can read the whole analogic range from 0 to 1024.

As this was a very simple example, I decided to code something more complex.

Because my board has only one input, i had to manage how to create different "scenes" (like in midi controllers) to modify different variables with the same input, once at a time.

I modified some generative graphics sketch I made, to control it with my hello potentiometer board.

In this case was very useful to use the controlP5 library, to have a sepparated GUI in an external window to manage wich parameter im modifying.

Checking if the toggle box is on (it´s associated with a boolean variable), to only modify (up or down) the variable when it´s needed (saving the previous state to avoid jumping values), constraining it between certain values using constrain() function.

I also added some code to calculate an average value, the input had a little of noise (+-1 only).

Smooth input Serial test from Marta Verde on Vimeo.

Input device Serial Processing Test from Marta Verde on Vimeo.

It´s not the best way to control a live visual, but is an approach. For this aim, I should use a new board with various input devices, like a midi controller. I started to design it in Eagle but I couldn´t mill it yet.

MAX/MSP

I love to use Max/MSP, I use it a lot for my work.

The nice thing about Max is that every object has a fully working help file, and editable. There is a Serial object to work with Serial Communication included with the software, it´s not an external (library).

Printing the Serial available ports on the Max Console:

So i know that I should use j port, and set it up to 9600 baud. I include this into the Serial object. Also, a metro to send triggers each 500ms to get the incoming value from the Serial port. Works nicely.

I can remove extra objects I dont need, and a visual Knob:

So I added a simple reading 3d Model to rotate the figure with the potentiometer. Max/MSP has nice GL libraries. The object I need is jit.gl.model. (All the objects related with video or graphics belongs to Jitter core, thats why all the objects starts with jit.). I also updated how to parse chars and obtain the whole range 0-1024.

I also made a little test casting shadows (as I have intended for my final project), but in Max 7, the new version has the property to add posibilty of shadows to the jit.gl.light object.

Max MSP Casting Shadows Serial Test from Marta Verde on Vimeo.

openFrameworks

openFrameworks it´s a nice toolkit of C++ for creative coding. It has at the examples a Serial Example. It´s working properly but the value received is in char values, so I need to figure it out how to cast char into floats or ints.

I could parse it, but something went wrong with the char sizing, and i couldn´t receive the whole line until the \n.

I found the ofxSimpleSerial addon, and tried it. Nicer results, automatically looks for the end of line \n to parse the messages.

But I noticed that the output values had a lot of delay at the console, they appeared ok, but it took like a second or two to refresh (even the output messages were fluid).

I also wanted to mix this Serial input example in openFrameworks with other graphics sketch that I made, but I started to have problems with my computer. It became to get freezed, or even, the grey MAC OSX screen of death, in both my laptop and my other computer. Maybe I´m asking too much to my Hello Potentiometer little board, but that happened me when I did crazyness over the serial port, not reading only a value.

Ouch


Spinning Rectangle Processing

Recursive input Processing

Max/MSP Serial + 3d Model


INTERFACE AND APPLICATION PROGRAMMING

Described your process using words/images/screenshots

X

Explained the protocols you used

X

Had a fun time

X

Outlined problems and how you fixed them

X

Included original code

X