Serial read IMU data

edited May 2016 in Arduino

Capture Serial monitor

I want to make a graph of IMU data that I’m getting from two sensors. Each sensor has tri-axial accelerometer and tri-axial gyroscope. So altogether I’m getting 12 readings as shown below how it display when I use the serial monitor. When I use the following code to read the serial I’m getting an error saying “ArrayIndexOutOfBoundsException:2” sometimes it shows as “Exception:1”. I have uploaded the full processing code here. I’m new to coding and I’m trying to build this for my final year research purpose. Please help me with this.

Tagged:

Answers

  • OK, so, I think it does not get the whole string each time and you receive an array with no length. I suppose you read serial strings in draw(), try using Serial Event, the code there will only work if you get some data, so there will be no chance you get a 0 length array.

Sign In or Register to comment.