We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpElectronics,  Serial Library › write multible serials to arduino
Page Index Toggle Pages: 1
write multible serials to arduino (Read 1940 times)
write multible serials to arduino
Jan 23rd, 2007, 9:11am
 
hello

i try to transfair an array of 8 integers from processing to an array in arduino with serial.write and serial.read.
sending and receiveing works fine but i have problems with the order of the numbers. the first integer i send has to get to the first position in the arduino array, and so on.
so far all my attempts didnt realy work.

could anyone help me on that?
Re: write multible serials to arduino
Reply #1 - Feb 8th, 2007, 4:51am
 
Rob,

I was wondering if you'd post your code so I can take a look. I'm working on a similar problem and may have the solution to yours... you need a header. a byte or int or whatever that always starts off your transmission. then arduino or processing will always look for that as the start and order them accordingly.
Re: write multible serials to arduino
Reply #2 - Aug 26th, 2007, 3:26am
 
Another common issue:-

Start by sending a handshake byte, then send the individual bytes, like this

port.write('A');// send A to represent the  beginning of the transmission
delay(10);
port.write(first); // send first
delay(10);
port.write(second); // send second
delay(10);
port.write(third); // send third etc

On the Arduino side:-

Use Serial.read(), count the number of bytes received, when the number of bytes received, have been received, then you have an array to to pull the bytes out in the order they were sent, eg, array[0] is the 'A', [1] is the first byte, [2] the second, etc etc
Page Index Toggle Pages: 1