configuration de l\'IMU chr-um6 via le Mbed

Dependencies:   mbed

main.cpp

Committer:
belloula
Date:
2012-03-06
Revision:
1:805f3ddb2ee5
Parent:
0:9aa10932bd4f

File content as of revision 1:805f3ddb2ee5:

#include "mbed.h"
//Connect IMU to pc via Xbee to calibrate IMU via "AHRSInterfacex86" soft

Serial pc(USBTX, USBRX);
DigitalOut myled(LED1);
Serial xbee(p9, p10);
DigitalOut rst1(p11);
Serial imu(p28, p27);

void fpc()
{
    while(pc.readable())
    {
            imu.putc(pc.getc());
    }
}

void fimu()
{
    while(imu.readable())
    {
          pc.putc(imu.getc());
          //pc.printf("%X\r\n",imu.getc());
    }
}

int main() 
{
    pc.baud(115200);
    imu.baud(115200);
    
    imu.attach(fimu);
    pc.attach(fpc);
    //reset xbee module
    rst1 = 0;   
    wait_ms(1);
    rst1 = 1;   
    wait_ms(1);
    
 
        while(1) 
         
        {
           pc.printf("salut");
           myled = 0;
           wait_ms(500);
           myled = 1;
           wait_ms(500); 
        }
}