EZIO Panorama

Now let's use the analog sensors on the EZIO to control the parts of the image. Each sensor will control the opacity of one part of the panorama. This one doesn't use any fancy loops or arrays or anything, it's very straightforward. But the repetitiveness should illustrate why loops and arrays are a Good Thing. ezio_panorama.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 // NOTE: this is a laborious way of doing this! // see the next example for a way that's much shorter PImage image1; PImage image2; PImage image3; PImage image4; PImage image5; PImage image6; PImage image7; PImage image8; EZIO ezio; void setup () { // load the images image1=loadImage("chicago_1.jpg"); image2=loadImage("chicago_2.jpg"); image3=loadImage("chicago_3.jpg"); image4=loadImage("chicago_4.jpg"); image5=loadImage("chicago_5.jpg"); image6=loadImage("chicago_6.jpg"); image7=loadImage("chicago_7.jpg"); image8=loadImage("chicago_8.jpg"); println(Serial.list()); ezio = new EZIO (this,"/dev/ttyUSB0"); size(800,200); } void draw () { background(0,0,0); int a; a=ezio.a2d(0); tint (255,255,255,a); image(image1,0,0,image1.width,image1.height); a=ezio.a2d(1); tint (255,255,255,a); image(image2,100,0,image2.width,image2.height); a=ezio.a2d(2); tint (255,255,255,a); image(image3,200,0,image3.width,image3.height); a=ezio.a2d(3); tint (255,255,255,a); image(image4,300,0,image4.width,image4.height); a=ezio.a2d(4); tint (255,255,255,a); image(image5,400,0,image5.width,image5.height); a=ezio.a2d(5); tint (255,255,255,a); image(image6,500,0,image6.width,image6.height); a=ezio.a2d(6); tint (255,255,255,a); image(image7,600,0,image7.width,image7.height); a=ezio.a2d(7); tint (255,255,255,a); image(image8,700,0,image8.width,image8.height); } void stop() { ezio.stop(); }