SVA | MFA Interaction Design
Fundamentals of Physical Computing Fall 2014 (14/FA IXG-5380-A)
1. Title: “Serendipity of Two Mobiles”
(2 mobiles in conversation affected by participants)
Interactive Art Installation System consisting of two mobiles. The first mobile (with sensors) detects distance, light and contact (button), emits sounds and displays a number related to the distance of a person to the system.
The second (panel) displays graphics affected by the interaction occurring with the object and will influence back to the first mobile (with sensors) completing a "circle".
The third object is an influencer for demonstration. The light sensor is affected by the green LED controlled manually.
By manipulating the sensors you can display different patterns.
If there is a touch (push of the button) the system will trigger a sound and special graphics to acknowledge contact with the system.
- EZ-Link Bluetooth Serial
- 5 Light Sensors (1 Inside the box)
// SVA|NYC|MFA Interaction Design
// Arduino/Processing Led Installation
import processing.serial.*;
Minim minim;AudioPlayer player;AudioInput input;
int currentFrame = 0;int numFrames=69;float h,m,s;
PImage[] images = new PImage[numFrames];
PImage background,clock,hours,minutes,seconds;
byte[][]digitos = {{ 1,1,1,1,1,1,0 },{ 0,1,1,0,0,0,0 },
{ 1,1,0,1,1,0,1 },{ 1,1,1,1,0,0,1 },{ 0,1,1,0,0,1,1 },{ 1,0,1,1,0,1,1 },
{ 1,0,1,1,1,1,1 },{ 1,1,1,0,0,0,0 },{ 1,1,1,1,1,1,1 },{ 1,1,1,0,0,1,1 }};
int redLed = 12;int buttonPin = 13;
void escribirPunto() {arduino.digitalWrite(11, Arduino.HIGH);}
void escribirDigito(byte digit) {byte pin = 4;
for (byte i = 0; i < 7; ++i) {arduino.digitalWrite(pin, digitos[digit][i]);++pin;}}
void apagarDigitos(){arduino.digitalWrite(4, Arduino.LOW);arduino.digitalWrite(5, Arduino.LOW);
arduino.digitalWrite(6, Arduino.LOW);arduino.digitalWrite(7, Arduino.LOW);arduino.digitalWrite(8, Arduino.LOW);
arduino.digitalWrite(9, Arduino.LOW);arduino.digitalWrite(10, Arduino.LOW);arduino.digitalWrite(11, Arduino.LOW);}
void counter() {for (byte j = 0; j < 10; j++) {escribirDigito(j);escribirPunto();
if (j==10){j=0;}delay(300);}apagarDigitos();}void birdON(){
player.play();image(images[currentFrame], width/2, height/2);
if (currentFrame==numFrames-1){ currentFrame=0;}else{currentFrame++;}}
void birdOFF(){player.close();player = minim.loadFile("cuckoo.mp3");}
minim = new Minim(this);player = minim.loadFile("cuckoo.mp3");input = minim.getLineIn();
frameRate(20);imageMode(CENTER);clock = loadImage("clock.png");hours = loadImage("hours.png");
minutes = loadImage("minutes.png");seconds = loadImage("seconds.png");
for (int i = 0; i < numFrames; i++) {String imageName = "BIRD_" + nf(i, 4) + ".png";
images[i] = loadImage(imageName);}
arduino = new Arduino(this, "/dev/tty.usbmodemfd131", 57600);
arduino.pinMode(0, Arduino.INPUT);
arduino.pinMode(1, Arduino.INPUT);
arduino.pinMode(2, Arduino.INPUT);
arduino.pinMode(3, Arduino.INPUT);
arduino.pinMode(buttonPin, Arduino.INPUT);
arduino.pinMode(redLed, Arduino.OUTPUT);
arduino.pinMode(4, Arduino.OUTPUT);
arduino.pinMode(5, Arduino.OUTPUT);
arduino.pinMode(6, Arduino.OUTPUT);
arduino.pinMode(7, Arduino.OUTPUT);
arduino.pinMode(8, Arduino.OUTPUT);
arduino.pinMode(9, Arduino.OUTPUT);
arduino.pinMode(10, Arduino.OUTPUT);
arduino.pinMode(11, Arduino.OUTPUT);
dot = loadImage("image.png");
opc = new OPC(this, "127.0.0.1", 7890);
float spacing = height / 16.0;
opc.ledGrid8x8(0, width/2-spacing * 4, height/2, spacing, 0, true);
opc.ledGrid8x8(64, width/2 + spacing * 4, height/2, spacing, 0, true);
float dotSize = height * 0.6 * (1.0 + 0.2 * sin(millis() * 0.01));
float dotSize = height * .7;
int distance_Value = arduino.analogRead(0);
int light_Value = arduino.analogRead(1);
int button_Value = arduino.digitalRead(buttonPin);
int potentiometerLeft_Value = arduino.analogRead(2);
int potentiometerRight_Value = arduino.analogRead(3);
println("DISTANCE VALUE:");
println(distance_Value/2);
float new_distance_Value = map (distance_Value, 20, 400, 20 ,150);
println("NEW DISTANCE VALUE:");
println(new_distance_Value);
float new_digit = map (distance_Value, 30, 400, 0 ,10);
if (new_digit>0&&new_digit<2){byte j = 0; escribirDigito(j);}
else if (new_digit>1&&new_digit<3){byte j = 1;escribirDigito(j);}
else if (new_digit>2&&new_digit<4){byte j = 2;escribirDigito(j);}
else if (new_digit>3&&new_digit<5){byte j = 3;escribirDigito(j);}
else if (new_digit>4&&new_digit<6){byte j = 4;escribirDigito(j);}
else if (new_digit>5&&new_digit<7){byte j = 5;escribirDigito(j);}
else if (new_digit>6&&new_digit<8){byte j = 6;escribirDigito(j);}
else if (new_digit>7&&new_digit<9){byte j = 7;escribirDigito(j);}
else if (new_digit>8&&new_digit<10){byte j = 8;escribirDigito(j);}
float new_light_Value = map (light_Value, 0, 900, 0 ,255);
println("NEW LIGHT VALUE:");
println(new_light_Value);
println("potentiometerLeft_Value");
println(potentiometerLeft_Value);
float new_potentiometerLeft_Value = map (potentiometerLeft_Value, 0, 200, 0 ,100);
println("new_potentiometerLeft_Value:");
println(new_potentiometerLeft_Value);
println("potentiometerRight_Value");
println(potentiometerRight_Value);
float new_potentiometerRight_Value = map (potentiometerRight_Value, 0, 200, 0 ,100);
println("new_potentiometerRight_Value:");
println(new_potentiometerRight_Value);
println("BUUTON PRESSED!");
image(dot, width/2 + new_potentiometerLeft_Value-100, width/2 + new_potentiometerRight_Value-200,
400-new_distance_Value,400-new_distance_Value);}arduino.analogWrite(12, int(new_light_Value));
if(new_light_Value<5){image(dot, width/2 , height/2, height*1.5, height*1.5);}
// http://www.adafruit.com/