Sending Serial Data from Processing to Arduino

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 . . . .

Advertisements

About engineerzero

Once and future engineer.
This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink.

One Response to Sending Serial Data from Processing to Arduino

  1. llennardd says:

    Hi,

    this may help in echoing the data

    http://arduino.cc/en/Tutorial/SerialCallResponseASCII

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s