Assignment

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

Neil's class Summary


Processing language

For this week assignment I chose to do use the hello.light board i fabricated during inputs devices week and investigate possible visualizations of the data using Processing 3.

Here are some sites I've been using for this task.
Processing reference site, you can also have access to sketch examples and video tutorials.
The Nature of Code.
Open Processing a site with free awsome sketches.

Also take some sites with documentation from previous years as a reference to adapt Neil's python code to the Processing language. Carolina Vignoli, edgaar, Arnau. Thanks them for such a good documentation!

And here are the lines that I adapted. First, I did a basic sketch to verify the reading of data and then I made several copies / editions by pasting parts of other codes and writing a few simple lines myself. Here is the basic code for reading the phototransistor data from Processing. You can download the working sketches from here .

import processing.serial.*;

Serial myPort;  // Create object from Serial class
float val;      // Data received from the serial port
float sensorData; // Data received from the serial port with 1,2,3,4 framing numbers filtered out
float low=0;
float med=0;
float high=0;
float value=0;
float byte1 = 0;
float byte2 = 0;
float byte3 = 0;
float byte4 = 0; // change the value to float
float eps = 0.5; // play with the filter time constant 
float filter = 1; // play with the filtered value 

void setup() {
  size(300, 300); 

  myPort = new Serial(this, "COM4", 9600); // change the port name
}

void draw() {
  while (myPort.available() > 0) {  // If data is available
    byte1 = byte2;
    byte2 = byte3;
    byte3 = byte4;
    byte4 = low;
    low = med;
    med = high;
    high = myPort.read();

    if ((byte1 == 1) & (byte2 == 2) & (byte3 == 3) & (byte4 == 4)) // Filter out the framing numbers: 1,2,3,4
      value =  low + high; // play with different values combinations as 256+high - low
      filter = (1-eps)*filter + eps*value; 

    println("THE VALUE IS " + value); //print to the screen
  }
  
 //EXPERIMENT WITH THE VISUALIZATION BELOW
  background(filter);
}
                    

Here are the results in action!





I would like to continue researching with other programming languages to obtain visual results from light information. I would also like to investigate the creation of mobile applications in a way to enable remote control of inputs and outputs.