Go Down

Topic: Project 14 Processing (Read 5909 times) previous topic - next topic

uaefame

THis project is basically changing the background color based on POT value.

I RUN The code in processing 2.2.1 (latest version) nothing is happening .

HeRE is the processing code
Code: [Select]
import processing.serial.*;
Serial myPort;

PImage logo;
int bgcolor = 0;

void setup(){
colorMode(HSB, 255);

logo=loadImage("http://arduino.cc/logo.png");
size(logo.width, logo.height);
println("Available serial ports:");
println(Serial.list());
//myPort = new Serial(this, Serial.list()[0], 9600);
myPort = new Serial(this, "COM3", 9600);
}

void draw(){
if(myPort.available() > 0){
bgcolor = myPort.read();
println(bgcolor);
}
background(bgcolor, 255, 255);
image(logo, 0,0);
}

uaefame

Anyone have problem or faced problem with project 14?

Is there anything wrong in my processing code? or all seem fine.

The background color takes forever to change for me not sure why.

I am having problem to change the background color instantly it change by after long period of time.

AlexSk

I'm running Ubuntu 14.04.
After installing Processing, the program works, but the backgroung did not change simultaneously.
When I move the potentiometer, background stays the same.
To change the Backgroung I have to stop the script in Processing, and run again.
Now it shows the new background.

Under Windows8 x64 it was working fine.

RussellD

For the Arduino code, if I modified the delay(1) code to be delay(100) in the loop() function, everything seemed to work very smoothly.   My best guess is that the delay(1) is pushing serial data into the PROCESSING buffer faster than it can be retrieved, and this is resulting in the PROCESSING app not seeing the current data quickly enough to be responsive.  I'm running under OS X (Yosemite) 10.10.2.

Happy coding!

Go Up