import processing.serial.*; Serial myPort;

int cirSize; Serial port; void setup() {

  // List all the available serial ports: 
  println(Serial.list()); 
  cirSize = 10;
  size(100,100);
  noStroke();
  // I know that the first port in the serial list on my mac 
  // is always my  Keyspan adaptor, so I open Serial.list()[0]. 
  // Open whatever port is the one you're using. 
  myPort = new Serial(this, Serial.list()[1], 9600); 

}

void draw() {

//background (0);

fill(random(255), random(255), random(255), cirSize*2); ellipse (mouseX, mouseY, cirSize, cirSize);

  while (port.available() > 0) {
    serialEvent();
    }

}

void serialEvent() {

  processByte((char)port.read());

}

void processByte(char inByte) {

  // add the latest byte from the serial port to array:
  cirSize = inByte;

}


Page last modified February 25, 2006, at 05:03 PM