I want to send data from my laptop to the Arduino-based robot. Processing is running on the laptop and Wiring on the Arduino. In Processing, the serial object is being called ‘myPort’ (it could have been called ‘Joe’ for that matter, but I decided to stick with the example in the book). This makes the command to send data: myPort.write().
On the Arduino side, the incoming bytes are recorded into a byte-typed variable called, imaginatively, ‘incomingByte.’ From there they are stored in a byte-typed array called cc_list, for ‘command code list.’
A byte value of 126 is used to signal End of File (EOF). I could have used 127 but that’s just a string of 1’s and I worry that something might arbitrarily generate a string of 1’s and mess me up. When a 126 is received, the LED on the board will flash three times, signalling that all the data is received.
Well, I think this does it for sending the data, but I can’t be sure unless I can echo the data back to the serial monitor. And that is where I’m stuck . . . .
this may help in echoing the data