In controlling some form of media in Processing using a physical component from Arduino, I decided to work with a potentiometer to change the tint of an image. For this project, I thought it would be appropriate to alter the Arduino logo, which I was able to access easily via a link on their site. I wrote my Processing code to recognize values from the potentiometer sent to Arduino and change the tint of the logo from black to blue depending on the position of the dial:
Arduino Code:
void setup() {
Serial.begin(9600);
}
void loop() {
int sensor1 = analogRead(A0);
int theMappedValue = map(sensor1, 0, 1023, 0, 255);
// keep this format
Serial.write(theMappedValue);
//Serial.println(); // add linefeed after sending the last sensor value
// too fast communication might cause some latency in Processing
// this delay resolves the issue.
delay(100);
}
Processing Code:
import processing.serial.*;
PImage photo;
Serial myPort;
int valueFromArduino;
void setup() {
size(300, 250);
photo = loadImage(“http://www.arduino.cc/arduino_logo.png”);
printArray(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
}
void draw() {
while ( myPort.available() > 0) {
valueFromArduino = myPort.read();
}
printArray(Serial.list());
println(valueFromArduino);
image(photo, 0,0);
if (valueFromArduino <150){
tint(255,0,0);
} else if(valueFromArduino > 150){
tint (0, 255, 255);
}
}
Documentation:
From Computer Vision for Artist and Designers, I thought the “Messa di Voce interactive software” by Golan Levin and Zachary Lieberman (2003) was noteworthy because it presented an interaction involving physical movement in space and the use of one’s voice to effect images on a projection. I found it particularly interesting how the software used vision algorithms and tracks audio signals to produce a corresponding image. This installation exemplifies how computers can receive information from the physical world to produce a physical response. While changing the hue of an image with a potentiometer is nowhere near as complex, I found it interesting to experience first-hand how computer programs can react to physical influences to facilitate an interactive experience.