I've run into some trouble on this project again.
I can change the background color but it keep's flashing. I think it's because of my port.read() values. They pretty much always bounce between 55 and 10, hardly taking notice of how much I've turned the potentiometer.
I have no experience dealing with serial communication, so I'm a bit lost at the moment.
My code:
import processing.serial.*;
Serial myPort;
PImage logo;
int bgcolor = 0;
void setup() {
colorMode(HSB, 255);
logo = loadImage("http://www.userlogos.org/files/logos/jumpordie/teamliquid-iphone.png");
size(logo.width, logo.height);
println("Avilable serial ports");
println(Serial.list());
myPort = new Serial(this, Serial.list()[1], 9600); // parameters : which application, which port & what speed
}
void draw() {
if (myPort.available() > 0) { // if(there is something in the buffer)
bgcolor = myPort.read();
print(" ");
println(myPort.read());
println(bgcolor);
}
background(bgcolor, 255, 255); // hue, brightness, saturation. max value 255
image(logo, 0, 0); // image() is used to draw. --- what to draw , x-coordiante to start, y-coordiante to start ---
}
1. Does anyone know what I should do in order to get proper readings?
2. What type of images can I use? Any image, or does it have to be a .jpg, .png etc...?
Thanks in advance!!