Reading serial data from Arduino
              in 
             Integration and Hardware 
              •  
              2 months ago    
            
 
           
             Ok I am attempting to graph some values sent from Arduino to Processing.
            
I want to send six (6) values one after the other repeating continually.
I am doing this like....
            
Serial.print(mapVal1);
Serial.print(mapVal2);
Serial.print(mapVal3...... and so on up to 6
            
When i come to receive the data i am doing...
 
            
for(int i=0;i<6;i++){
// get data from port if available
while (myPort.available() > 0) {
r = myPort.read();
}
            
the problem is i have no way of knowing which r received belongs to which sensor.
            
Do i have to write some 2 way com script?
Can I send a new line or tab to say the next bite is data
Can i send a word to identify each sensor i.e. S1 and wait for S1 to be received?
What is preferred method please?
 
           
 
            
           I want to send six (6) values one after the other repeating continually.
I am doing this like....
Serial.print(mapVal1);
Serial.print(mapVal2);
Serial.print(mapVal3...... and so on up to 6
When i come to receive the data i am doing...
for(int i=0;i<6;i++){
// get data from port if available
while (myPort.available() > 0) {
r = myPort.read();
}
the problem is i have no way of knowing which r received belongs to which sensor.
Do i have to write some 2 way com script?
Can I send a new line or tab to say the next bite is data
Can i send a word to identify each sensor i.e. S1 and wait for S1 to be received?
What is preferred method please?
 
              
              1  
            
 
            