EZIO Panorama, Better
This is the same thing, but using loops and arrays to make the code much much shorter. Remember, "A Good Programmer is a Lazy Programmer".ezio_panorama_2.zip
import processing.serial.*;
// load 8 images to create a panorama
// use the values of the 8 a2d sensors to
// fade them in and out
// use Arrays and Loops for Less Typing!
PImage[] chicago;
EZIO ezio;
void setup ()
{
// load the images
int i;
chicago = new PImage[8];
for (i=0 ; i < 8 ; i++)
{
String filename = "chicago_" + (i+1) + ".jpg";
chicago[i]=loadImage(filename);
}
println(Serial.list());
ezio = new EZIO (this,"/dev/ttyUSB0");
size(800,200);
}
void draw ()
{
background(0,0,0);
int a;
int i;
for (i=0 ; i < 8 ; i++)
{
a=ezio.a2d(i);
tint (255,255,255,a);
int x=i * 100;
image(chicago[i],x,0,chicago[i].width,chicago[i].height);
}
}
void stop()
{
ezio.stop();
}