Arduino Confetti

Erratica - Confetti

A photoresistor controlling the size, color, alpha and placement of the circles in processing.

Code and clip after the jump below.

img_1766

Erratica - Confetti

[flv:arduino_confetti.flv arduino_confetti.jpg 500 375]


//Processing

import processing.serial.*;

Serial myPort;
int val;

void setup()
{
size(200, 200);
smooth ();
String portName = Serial.list()[0];
myPort = new Serial(this, portName, 9600);
}

void draw(){

if ( myPort.available() > 0) {
val = myPort.read();
}

if (val > 20) {
fill (random (val),random (val), random (val), val*1.25);
ellipse (random (val),random (val),val/4, val/4);

}

if (val >20){
println (val);
}
}

//arduino + wiring

int potPin = 0;
int val = 0;

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

void loop (){
val = analogRead (potPin)/4;
delay (100);
Serial.print (val, BYTE);
Serial.println();

}

Tags: ,

2 Responses to “Arduino Confetti”

  1. brandt says:

    Jose, that’s awesome! So you’re running that straight from Processing? You don’t have to call the arduino library?

  2. coche says:

    Hey Brandt
    Yeah, it’s running straight from Processing. I’ve uploaded a short clip so you can take a peek at it. Now I’ll come up with something less banal than just circles on the screen :)