Project 14 (Tweak the Arduino Logo)

As for the color changing rate problems you are seeing, it appears to be a serial buffering issue. The Arduino is sending reading sample updates too fast for Processing to keep up with. I don't know why they made the Arduino code sample that fast (1 millisecond delay is about 1000 samples per second), it's not really necessary.

But here is a quick fix workaround to this. Change the sample delay from 1 millisecond to 100 milliseconds. This should slow down the Arduino sampling slow enough for Processing to keep up with.

Try this:

void loop() {
  // read the value of A0, divide by 4 and 
  // send it as a byte over the serial connection
  Serial.write(analogRead(A0)/4);
  delay(100);
}
2 Likes