Week16 - interface and application programming //////

Assignment:
* Write an application that interfaces with an input &/or output device that you made, comparing as many tool options as possible.





PROCESSING

For this week I started the assignment with processing, I have used processing before but never with an input. I used the magnetic field sensor as the input from Week11.

Ferdi gave us a review of almost all posibles interfaces that we could use, also an introduction to processing + input devices where he explained us how to communicate the input device using as an example Neil’s Python and C codes.

SERIAL COMMUNICATION

The first step was how to get the data coming from the serial port in Processing.


For the serial communication in processing we have to use the serial class, at the beginning of the sketch define:

import processing.serial.*; // serial class

Serial myPort; // Create object from Serial class


In void setup():

Use this command for connecting to your serial port, in my case the name of my serial port was /dev/ttyUSB0, so:

myPort = new Serial(this, "/dev/ttyUSB0", 9600);



In void draw():

Use this commands for reading from the serial port, which passes the values from the board to Processing:

myPort.available() // If data is available
myPort.read() // reading from the serial port

SKETCH 1

For the first sketch I use as an example the sketch from figueiredo.tiago form fabacademy 2015, taking the values from the Neil’s Python code (hello.mag.45.py) that I needed in order to use my sensor:


From python file:




To Processing:













interface and AP1 from carovignoli on Vimeo


SKETCH 2

For the sketch 2 and 3, I followed the same steps from the sketch 1 but I changed the input mousex/y for value.



interface and AP2 from carovignoli on Vimeo.


SKETCH 3

interface and AP3 from carovignoli on Vimeo.


SKETCH 4

For this sketch I wanted to simulate a magnetic field using an image and changing the brightness based on the distance of the sensor.

interface and AP4 from carovignoli on Vimeo.





Download files



home