Interaction with Visual Basic 2010

The modified code does not fit all cases, because the Arduino is 10,000 times faster than the serial line it does the entire loop for every character it receives. That's why you either have to wait for N characters to arrive (and know when there is an idle line) OR have a delimiter.

Also how do you know when a new batch of data starts? Lets say VB is sending three characters at 2sec intervals

123-----------------------234-------------------456--------------------567
                           ^

and you start reading the serial port at the ^ position.

You will read 344.

Now if VB sends "<123>", Arduino ignores all characters until it sees < and reads until > then you both have a method to sync on the data and know when a packet ends.


Rob