Recitation 10: Media Controller – By Skyler Liu

Component:

1 * Arduino Uno

1 * USB-B to A Cable

1 * 10K Potentiometer

Jumper Cables

Video:

Code:

Processing:

import processing.video.*;
Capture cam;

import processing.serial.*;

Serial myPort;

int valueFromArduino;

void setup() {
size(640, 480);
cam = new Capture(this, 640, 480 );
cam.start();
background(0);

printArray(Serial.list());

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

void draw() {
while ( myPort.available() > 0) {
valueFromArduino = myPort.read();
}
println(valueFromArduino);
////This prints out the values from Arduino
background(0);
if (cam.available()) {
cam.read();
cam.loadPixels();
}
int circleSize = valueFromArduino+5;
int w = cam.width;
int h = cam.height;
for (int y = 0; y < h; y+=circleSize){
for (int x = 0; x < w; x+=circleSize) {
int i = x + y*w;
fill( cam.pixels[i] );
ellipse(x,y,circleSize,circleSize);
}
}
cam.updatePixels();
}

Arduino:

void setup() {
Serial.begin(9600);
}

void loop() {
int sensorValue = analogRead(A0)/ 62;
Serial.write(sensorValue);

delay(10);
}

Process & Reflection:

In the recitation, I made a media controller which applies one potentiometer to adjust the size of pixels of the live cam. I used sample code from class 22 as the basis and made modifications of setting the variation to controll the pixels of cam and soon got success. 

In relation to the reading “Computer Vision for Artists and Designers”, I think the technology used in my work is somehow different from the computer vision projects described in the reading. In my work, the value from potentiometer was the input that controlled the variation of output; the interaction happened between my computer and user’s operation of the potentiometer. My computer didn’t have to interact with the content of video or image. However, in the reading, projects as Messa di Voce receive the content of the video – people’s movements themselves as the input which triggers the corresponding output. I think such interaction is more interesting than the way in my work because it is more flexible and gives users more possibilities to explore, and this is a direction in which all the interactive projects should try forwards.

Leave a Reply