Project 14 (Tweak the Arduino Logo)

Hello.

I have downloaded the last version of processing (2.0b7), but executing the processing code I receive the "serial does not run in 64-bit mode" (I use Windows 7 x64), any solution?

Thanks.

Hi,

I had the same. but are now using the 32 bit version. works well...
I needed to copy paste the code though.

cheers, Sander

Hello,
I've another problem with project 14. The color sometimes changes very slowly or somtimes it doesn't change at all. It's the same with the numbers in the black field in processing. I've look at the poti's values at a arduino programm and it works. They change very fast. I think the code is right because I've tested it with the from the arduino software, too. There's the same problem.
Can anyone help me?

posted by tiffi:

Hello,
I've another problem with project 14. The color sometimes changes very slowly or somtimes it doesn't change at all. It's the same with the numbers in the black field in processing. I've look at the poti's values at a arduino programm and it works. They change very fast. I think the code is right because I've tested it with the from the arduino software, too. There's the same problem.
Can anyone help me?

I have the exact same issue! I've actually installed Processing and Arduino on both my Windows 7 laptop and my Macbook Air running Mountain Lion and I have the same issue on both (exactly as described above by the previous poster). On the Windows machine I've installed the 32-bit version and on the Mac I've selected the 32-bit option in preferences.

Does anyone have an explanation or a fix?

Thanks,

Jeff

swapper:
I have downloaded the last version of processing (2.0b7), but executing the processing code I receive the "serial does not run in 64-bit mode" (I use Windows 7 x64), any solution?

This is from the Processing site:

I know this is an issue.

We all very much want a 64-bit serial library.

I don't have time to make and test one across all the necessary platforms.

We hope that someone will soon.

It is marked as an “enhancement” because we have never had a 64-bit library. Calling it a major bug won't change the fact that I don't have time to fix it right now.

For the time being, comment #5 explains a workaround.

"comment #5: On Linux and Windows, download the 32-bit version of Processing. "

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

Thank you Hiduino.

I'm on lowly project 7 but already have this on all the sketches. There's one,for example (I forget which) that shows 2 lines of values and it's impossible to read them unless you slow it all down. Worked for me. Would recommend it for v2.

Hello.

I downloaded the 32-bit version but I still can't compile. I get the same error that I got on the 64-bit version,

"serial is only compatibl wit the 32-bit download of Processing."

.

Someone pls help!

sina92:
Hello.

I downloaded the 32-bit version but I still can't compile. I get the same error that I got on the 64-bit version,

"serial is only compatibl wit the 32-bit download of Processing."

.

Someone pls help!

Which Arduino are you trying this with?

EDIT**
I restarted my PC n no it work's just as intended.

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!!

hiduino:
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);
}

There is a way to fix this issue changing only the Processing code to clear the buffer after reading a byte:

if ( myPort.available() > 0) {
 // read the value and store it in a variable
 bgcolor = myPort.read();
 myPort.clear();
 
 // print the value to the status window
 println(bgcolor); 
}

bit og a late reply, but it if helps anyone else, I struggled first with slow updating, then I slowed the delay down on the arduino analogWrite. After that I struggled with flicker, I guess because there was no value in the serial message when Processing read it.

Anyway, I added a string to ignore values of -1 in my processing code


if (bgcolor!=-1) {background(bgcolor, 255, 255);
image(logo, 0, 0);
}

import processing.serial.*;
Serial myPort;

PImage logo;
int bgcolor =0;
void setup() {
colorMode(HSB,255);
logo = loadImage("http://arduino.cc/logo.png");
size(300,300);

println("Available Serial ports:");
println(Serial.list());

myPort= new Serial(this, Serial.list()[2],1200);
}
void draw() {
if (myPort.available()>1) {

bgcolor = myPort.read();
myPort.clear();
println(bgcolor);
}
if (bgcolor!=-1) {background(bgcolor, 255, 255);
image(logo, 0, 0);
}
}