Serial port help

I'm planing to have processing code just printing all the values at the same time.
I have my processing code alrady written.
I uploaded your code to arduino and tested it with the serial monitor and it worked like a charm.
When i try to pass 123123123 with processing it dosen't do anything.
Well my LED flashes for a milisecond and thats all.
The code is pritty simple and should work.

import processing.serial.*;
Serial port;  
void setup() {
 port = new Serial(this, Serial.list()[0], 9600);
  port.write(123123123);
}

I realy don't know if i should bother with you with this on arduino forum but i think its not a processing problem. I'm doing something wrong again :slight_smile:

And yeah, you'r right i usualy get desperate enaugh to just sweep it under the carpet. It never realy works but i get my mind at peace for a few minutes.
Thanks!

Sorry I know nothing about processing.

port.write(000255000);

does this send 9 characetrs? If so I'm gobsmacked.


Rob

Yeah in code it looks like it sends a string or a number but the serial comunication port works only with sending individual chars one by one.
So port.write(123123123) is equivalent as sending each digit seperatly.
And i tryed it both ways and its the same thing.
I know arduino is getting something cause when i run the code the LED's flash a bit. but they don't light up as they should.
Wierd :slight_smile:
Thanks again for all the help!

In the code in reply #15, j never gets reset, so once the allocates space in RGB is filled, there's no telling where the next bytes read are written. Certainly not where you want them, that's for sure.

The port.write() function can write a number of things - bytes, chars, ints, and arrays of bytes. Unlike the Arduino Serial class, which has print and write methods that do different things, Processing sends all data to the serial port as strings, so the value entered is converted to a string to be sent.

I've lost track of what code is on the Arduino, but since this thread is still active, I assume you still have a problem. Please post the current code, if that is the case - both Processing's sending code and the Arduino code.