This example shows how to read serial data from your Arduino into Processing.
Arduino setup
Connect three photoresistors via a 10K resistor to a 5V power source (you can use your Arduino).
Connect the analog inputs A0, A1 and A2 as in the image below:

Arduino Setup
Arduino sketch
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.write(map(analogRead(A0),0,1023,1,66));
delay(50);
Serial.write(map(analogRead(A1),0,1023,67,132));
delay(50);
Serial.write(map(analogRead(A2),0,1023,133,199));
delay(50);
}
Processing Code
/*
Arduino - Read and graph multiple values
from Serial Port example
*/
import processing.serial.*;
Serial myPort;
int mWidth=1000;
int mHeight=200;
int mValue;
int[][] mPoints;
void setup() {
// set window size and background color
size(mWidth, mHeight);
// init objects/vars
// make sure to replace COM3 with the correct port name:
myPort = new Serial(this, "COM3", 9600);
mPoints = new int[mWidth][2];
for(int i=0;i<Width;i++){ mPoints[i][0]=i; mPoints[i][1]=mHeight; } } void draw() { if ( myPort.available() > 0) {
background(0); // removes all prior drawn lines
// draw dividers
stroke(0,0,120); // dark blue
line(0,67,mWidth,67);
line(0,133,mWidth,133);
stroke(0,255,0); // back to green
// read the value
mValue = myPort.read();
for(int i=0;i<mWidth;i++){ if(i==mWidth-1){ mPoints[i][1] = mHeight-mValue; }else{ mPoints[i][1] = mPoints[i+1][1]; } if(i>3){
line(mPoints[i-3][0],mPoints[i-3][1],mPoints[i][0],mPoints[i][1]);
}
} // next for
} // end if port available
}
The result is a real-time graph that shows the light intensity: