Start a new topic

YEI + UART communication with Arduino

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);

        

      }

    }   

    

  

}


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.  

I just got a 3 Space and I am trying to do the same thing, and I'm having the same problem. Did you ever get this to work?

 

Login or Signup to post a comment