Recitation 9: Media Controller Cathy Wang

// IMA NYU Shanghai
// Interaction Lab
// This code receives one value from Arduino to Processing 

import processing.serial.*;


Serial myPort;
int sensorValue;
PImage photo;
float b=1;
float px;



void setup() {
  size(360, 640);
  photo = loadImage("Liuwen.jpg");

  printArray(Serial.list());
  // this prints out the list of all available serial ports on your computer.

  myPort = new Serial(this, Serial.list()[0], 9600);
  // WARNING!
  // You will definitely get an error here.
  // Change the PORT_INDEX to 0 and try running it again.
  // And then, check the list of the ports,
  // find the port "/dev/cu.usbmodem----" or "/dev/tty.usbmodem----" 
  // and replace PORT_INDEX above with the index number of the port.
}


void draw() {
  image(photo, 0, 0);
 // px=sensorValue;
  printArray(sensorValue);
  // to read the value from the Arduino
  while ( myPort.available() > 0) {
    sensorValue = myPort.read();
  }
  // image(photo, 0, 0);
  //filter(BLUR, b);
  //b= b+0.1;
  if (sensorValue >= 0 && sensorValue< 60) {
    filter(INVERT);
  } else if (sensorValue >= 40 && sensorValue< 80) {
    filter(BLUR, 6);
  } else if (sensorValue >= 80 && sensorValue< 120) {
    filter(GRAY);
  } else if (sensorValue >= 120 && sensorValue< 160) {
    filter(THRESHOLD);
  } else if (sensorValue >= 160 && sensorValue< 200) {
    filter(POSTERIZE, 4);
  } else if (sensorValue >= 200 && sensorValue< 255) {
    filter(BLUR, b);
    b= b+0.1;
  }
}

Reflection:
The first thing I learned during the processing is that the processing page shows an error and we can not find any mistake of the content, we can check if the position of brace is correct. Another is that we can map in the Arduino. In the processing, sometimes we may come across some unknown problem with mapping. After reading Golan Levin’s essay, I gain a different perspective of the whole-body interaction. At first, we want to use a balance board and add sensors to that board to transfer input. While the example of “Interaction modules from Myron Krueger’s Videoplace, 1969-­1975″ inspires me that we can install sensors to our body to trace our movements and transfer them to the computer directly. If we add the sensors to the balance board, it may overreact because some of our movements are out of balance. If may hard to use the balance board to send instructions.

Leave a Reply