IMU Razor 9dof

Hi!!

Im interfacing my arduino with the razor, its very easy to read the angles that the razor sends via serial, the main issue is that i want to make a comunication system between the two of them. does anyone had a sketch of comunication between to arduinos? a simple read write serial protocol??

thanks!!

cheers!!

What i did is modify the output of the IMU Razor to SYAW:ROLL:PITCHE

so you get a string like S180:180:180E

Then on the mega that recieves:

 int serCase;
 char serChar;
  //quad_init();

void loop(){
  if(Serial1.available()) {
    serChar = Serial1.read();
  if(serCase == 0){
  // do your stuff here
}

 if(serCase == 1){
      groll += serChar;
    }
    if(serCase == 2){
      gpitch += serChar;

    }
    if(serCase == 3){
       gyaw += serChar;
  
    }

 if(serChar == 'S'){
      serCase = 1;
    }
    if(serChar == ':'){
      serCase++;

    }
    if(serChar == 'E'){
      serCase = 0;
    }

}
}

Basicly a state machine which puts your characters that you recive in a variable depening on the delimiters. dont know if it is the best way but it is a way ;)

Hi!

10x for the reply…

i started doing a simple comunication system between one arduino and the razor 9dof…

i modified the razor sckech and add the sentence that IF was serial data avaiable, the it will send the angles… upload it to the razor and test it… it work beautiful… every time i send something via serial, the razor answer the angles…

now, the next step was to program the arduino…

my logic was as follows: if its time to receive angles, first the arduino sends something via serial, and then receive the angles… but its not working… hehehehe

i need to make a better sckech for the arduino… but im still working on that…

cheers!!