Hello, does anyone know how to split a string into several separate floats? I’m receiving an array of bytes from my Bluetooth controller, which sends some data from gyroscope, compass and accelerometer sensors. The lines which it sends look like that:
0.45 -145 63.5
0.46 148 63.3
0.43 125 68.3
0.22 - 165 68.3
Where these are Accel. value / Gyro. value / Comp. value separated with just spaces like " "
The way I convert the array of bytes into a string will, perhaps, be something like this:
byte [] msg = device.read ();
string content = System.Text.ASCIIEncoding.ASCII.GetString (msg);
How can I split this string into 3 corresponding float numbers?
Perhaps I need something like this:
float accelerometer = float.Parse (certain string part);
float Gyroscope = float.Parse (certain string part);
float Compass = float.Parse (certain string part);
but I don’t really know how to do that properly.
Can anyone help?