Just following up to see if you had any luck with this. We are having tremendous problems with Unity 5 and the YEI and think maybe we can circumvent these problems by reading the YEI through the arduino.
For what its worth, I'm communicating to a Three Space USB on a com port using VS2017 VB.net. Two commands in a batch message Euler (1) and Heading (35). Serial communication got a little tricky but I seem to be getting reasonable results now.
Steph Anie
Hello all!
Working on a project, and I'd like to read Euler angles from the YEI 3 Space using UART communication with an Arduino.
Has anyone had success with this before? It seems simple enough, but I haven't been able to read any values back. Thanks so much in advance.
// YEI 3 Space Sensor
byte temp = 0;
byte inByte101 = 0;
byte inByte102 = 0;
byte inByte103 = 0;
float roll = 0; // create variables to store roll, pitch, yaw values
float pitch = 0;
float yaw = 0;
void setup() {
Serial.begin(115200); // opens serial port, set baud rate to 57600 bps
}
void loop() {
Serial.write(':1\n '); // colon = start of ASCII packet, Command Value, Command Data, End of packet
temp = Serial.read();
Serial.print(temp);
if (temp == '0') // success = 0 in ASCII
{
temp = Serial.read(); // read logical ID to see which sensor sent response
temp = Serial.read(); // read data length
if (temp != '0')
{
inByte101 = Serial.read();
inByte102 = Serial.read();
inByte103 = Serial.read();
pitch = inByte101;
yaw = inByte102;
roll = inByte103;
Serial.print("PYR: ");
Serial.print(pitch);
Serial.print(" ");
Serial.print(yaw);
Serial.print(" ");
Serial.println(roll);
}
}
}
1 person has this question