We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I using a LSM9DS1 9 Degrees of Freedom IMU Breakout from Sparkfun. I can read the data using Processing this is the data that is being sent from the Arduino.
LSM9DS1 9-axis motion sensor...
LSM9DS1 accel/gyroI AM 68 I should be 68
LSM9DS1 magnetometerI AM 3D I should be 3D
LSM9DS1 is online...
accel sensitivity is 16.38 LSB/mg
gyro sensitivity is 0.13 LSB/mdps
mag sensitivity is 8.19 LSB/mGauss
Perform gyro and accel self test
Calibrate gyro and accel
accel biases (mg)
-21.97
-71.11
-44.25
gyro biases (dps)
-0.87
1.33
-1.67
mag biases (mG)
18.07
9.64
-64.33
LSM9DS1 initialized for active data mode....
-2.52, 174.62, 146.33
I'm having problems just selecting the parts of data I would like to display and use. like Display "LSM9DS1 9-axis motion sensor..." and "LSM9DS1 is online..." and "LSM9DS1 initialized for active data mode...." then use the remaining data (X,Y,Z) to update my rotating cube. the cube response to the data if I only send the X,Y,Z but I get errors when sending all the data. is there a way I can do this?
This is the code I'm using at this time
void serialEvent(Serial p)
{
String incoming = p.readString(); // reads all the data correctly
println(incoming);
if ((incoming.length() > 8))
{
String[] list = split(incoming, " ");
if ( (list.length > 0) && (list[0].equals("mode....")) )
{
println("mode.... was found");
}
}
}
I'm having trouble understanding the proper way to go about this, any help would be greatly appreciated
Answers
Tricky. You could split the incoming string by comma and try to convert it to a float, if the resulting number(s) are NaN just print out the string, else parse the number for your purposes.
https://processing.org/reference/floatconvert_.html
colouredmirrorball, I'm having a bit of trouble getting a grasp of the useage of this. Can you point me to an example?
https://forum.Processing.org/two/discussion/15102/arduino-and-processing`