Connecting Arduino to Processing

Contributors: b_e_n
Favorited Favorite 36

Tips and Tricks

In developing your own projects with Arduino and Processing, there are a few 'gotchas' that are helpful to keep in mind in case you get stuck.

  • make sure your baud rates match
  • make sure you're reading off the right port in Processing - there's a Serial.list() command that will show you all the available ports you can connect to.
  • if you're using the serialEvent() method, make sure to include the port.bufferUntil() function in your setup() method.
  • also, make sure that whatever character you're buffering until (e.g., '\n') is a character that you're actually sending from Arduino.
  • If you want to send over a number of sensor values, it's a good idea to count how many bytes you're expecting so you know how to properly parse out the sensor data. (the example (shown below) that comes with Arduino gives a great example of this:

alt text

This is the example to select for some good sensor parsing code