Interface and Application Programming

interface with an input or output

The goal for this week: create a GUI that is controlled by an input device or can control an output device

Processing

This week I took time to learn how to create images in Processing
I found some great tutorials from Daniel Shiffman here, and on this YouTube channel.

Colour and Transparency
I started by editing some existing codes to get different effects; I rewrote the getting started tutorial so that the circles display colours and transparencies. Then I altered the controls on output so they were dependent on the X and Y positions of the mouse, using mouseX and mouseY. For the final code, I would substitute the high and low input variables for mouseX and mouseY

One useful trick: it is possible to create files of the images created by adding saveFrame("output.png") at the end of the draw loop.


My second attempt involved reading the weather from Yahoo.com. Again,this tutorial shows how to read in the XML for a basic weather reader. I edited the code so that the colour of the bar was dependent on the temperature, added more zipcodes to be checked and tried to show the city. The program requests it, but doesn't print it in the GUI -- something to follow up on for next time.

Serial Port
In order to apply this I still needed to interface it with a device!
My planned workflow was as follows:
touch sensor > serial port > speaks to arduino > values pulled into processing > output a visualisation of the information.
I started by trying to get information from the serial port. I started with the Graph tutorial (see below). I received a constant error stating that 'Serial' was not declared in this scope. Despite numerous attempts I was unable to open the port.
My second attempt was with Pyserial. The plan was to read from the ports with PySerial and then to use the inputs in the Processing IDE.

One useful trick: it is possible to create files of the images created by adding saveFrame("output.png") at the end of the draw loop.