Announcements

November 24, 2007
Reading for November 27th, are now posted. Enjoy!

October 2, 2007
To upload your thoughtless acts, create a new assignment page like any other lab. You'll see "Thoughtless Acts" listed as one of the assignment options.

May 24, 2008
This site has been archived and is no longer editable. Stay tuned for the next version, coming in the fall!


Marky Mark's Breakdance Machine

Project Members: 
Hannes Hesse

MARKY MARK'S BREAKDANCE MACHINE

Make Marky Mark show his craziest dance moves!

In this assignment, a force-sensitive resistor placed in or underneath a shoe acts as a video controller for a short clip that shows Marky Mark dancing.

Like Lucky Luke's shadow, Marky tries hard to keep up with your moves, but he's never quite fast enough for you!

HARDWARE COMPONENTS USED

1 Resistor
1 Force-sensitive resistor
1 Shoe
Arduino computer
Solderless breadboard
Jumper wires

ARDUINO CODE

int photPin = 0;
int ledPin = 10;

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

void loop() {
int v = analogRead(photPin);
// Serial.print("v: ");
Serial.println(v);

analogWrite(ledPin, v / 4);
delay(50);
}

PROCESSING CODE

import processing.video.*;
import processing.serial.*;

Movie myMovie;

String portname = "/dev/tty.usbserial-A4001nKF"; // or "COM5"
Serial port;
String buf="";
int cr = 13; // ASCII return == 13
int lf = 10; // ASCII linefeed == 10

void setup() {
size(320, 240);
frameRate(10);
smooth();
port = new Serial(this, portname, 9600);
println("loading movie...");
myMovie = new Movie(this, "dance-full-sm.mov");
println("done.");
myMovie.play();
}

void draw() {
image(myMovie, 0, 0);
}

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

// called whenever serial data arrives
void serialEvent(Serial p) {
int c = port.read();
if (c != lf && c != cr) {
buf += char(c);
}
if (c == lf) {
int val = int(buf);
buf = "";
float relLoc = val / 1024;
if (myMovie != null) {
myMovie.jump(myMovie.duration() * val / (1024 * 2));
}
}
}


VIDEO MATERIAL

I found that for low latency, videos of the size 320 * 240 work best, and it helps when they're uncompressed. 
For some sample video material, see http://people.ischool.berkeley.edu/~hannes/marky/


DEMO




Comments

hannes, absolutely fun lab!

hannes, absolutely fun lab! Thanks so much for bringing it in! I'm sorry your FSR broke :(


Powered by Drupal - Design by Artinet