Monika & Published & Destroyed this

From Hackers & Designers
Revision as of 17:02, 13 February 2016 by Hdsb (talk | contribs)

I am a group

Two bodies generate value together. Visitors can activate a video by finding the right positions on a square mat. What is hard to do by oneself, is possible to do together if two are willing to be close to each other.

File:IMG 5761.jpg


Processing code: import processing.serial.*; import processing.video.*;

Movie myMovie; Movie myMovie2; Serial ser;

int width = 640; int height = 360;

void setup() {

 size(640, 360);
 //surface.setSize(width, height);
 println(Serial.list());
 ser = new Serial(this, Serial.list()[2], 9600);
 
 myMovie = new Movie(this, "empty-480.mov");
 myMovie.loop();
 
 myMovie2 = new Movie(this, "people-480.mov");
 myMovie2.loop();

}

void draw() {

 background(0);
 //fill(20);
 
 image(myMovie, 0, 0);
 //tint(255, 120);
 
 //println( "!!!!");
 while (ser.available() > 0) {
   int inByte = ser.read();
   println(inByte);
   image(myMovie2, 0, 0);
 }

}

// Called every time a new frame is available to read void movieEvent(Movie m) {

 m.read();

}

Arduino button code: /*

 Button
Turns on and off a light emitting diode(LED) connected to digital
pin 13, when pressing a pushbutton attached to pin 2.


The circuit:
* LED attached from pin 13 to ground
* pushbutton attached to pin 2 from +5V
* 10K resistor attached to pin 2 from ground
* Note: on most Arduinos there is already an LED on the board
attached to pin 13.


created 2005
by DojoDave <http://www.0j0.org>
modified 30 Aug 2011
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Button
*/

// constants won't change. They're used here to // set pin numbers: const int buttonPin2 = 2; const int buttonPin3 = 3; const int buttonPin4 = 4; const int buttonPin5 = 5;

const int ledPin = 13; // the number of the LED pin

// variables will change: int buttonState2 = 0; int buttonState3 = 0; int buttonState4 = 0; int buttonState5 = 0;// variable for reading the pushbutton status

void setup() {

 Serial.begin(9600);
 // initialize the LED pin as an output:
 pinMode(ledPin, OUTPUT);
 // initialize the pushbutton pin as an input:
 pinMode(buttonPin2, INPUT_PULLUP);
 pinMode(buttonPin3, INPUT);
 pinMode(buttonPin4, INPUT);
 pinMode(buttonPin5, INPUT);

}

void loop() {

 // read the state of the pushbutton value:
 buttonState2 = digitalRead(buttonPin2);
 buttonState3 = digitalRead(buttonPin3);
 buttonState4 = digitalRead(buttonPin4);
 buttonState5 = digitalRead(buttonPin5);

// Serial.print( buttonState2 ); // Serial.print( " " ); // Serial.print( buttonState3 ); // Serial.print( " " ); // Serial.print( buttonState4 ); // Serial.print( " " ); // Serial.print( buttonState5 ); // Serial.println( " " );

 // check if the pushbutton is pressed.
 // if it is, the buttonState is HIGH:
 if (buttonState2 == 1 &&
     buttonState3 == 1 &&
     buttonState4 == 1 &&
     buttonState5 == 1) {
       
     // turn LED on:
     digitalWrite(ledPin, HIGH);
     Serial.print(1);
 } 
 else {
   digitalWrite(ledPin, LOW);

// Serial.print(0);

 }
 

}