Recitation 9: Media Controller, By Megan See

Recitation 9: Media Controller

For this recitation, I made my own image invert when a button is pressed in arduino. First I made sure that the information from the arduino button was sending to processing, and then added the image and inversion inside of an if statement in processing. 

After reading Computer Vision for Artists and Designers, I reflected on how technology was used in my project. The user’s input causes Arduino and processing to communicate and creates an output. They already communicate to have the picture show, but then works again with each other in order to have to filter. It is very similar to the emotion detecting project that was mentioned in the reading. It was communicating the whole time, taking in the data from the camera, but once the person’s facial expressions fit certain criteria (like pressing the button on mine) an alarm would sound saying that they needed to be more expressive. 

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

import processing.serial.*;


Serial myPort;
int valueFromArduino;


void setup() {
  size(800, 531);
  background(0);

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

  myPort = new Serial(this, Serial.list()[2], 9600);

}


void draw() {
  // to read the value from the Arduino
  background(0);
  //ellipse(250,250,valueFromArduino,valueFromArduino);
  while ( myPort.available() > 0) {
    valueFromArduino = myPort.read();
  }
 

  
  PImage photo;
  photo = loadImage("pitt.png");
  image(photo, 0, 0);
  if (valueFromArduino == 1){
    println("1");
     filter(INVERT);
  }
 

  println(valueFromArduino);//This prints out the values from Arduino
}


Leave a Reply