Hello Word for the LG1300L IMU

Dependencies:   LG1300L_IMU TextLCD mbed

main.cpp

Committer:
mjenkins11
Date:
2013-03-05
Revision:
3:e57684eb3556
Parent:
1:99171a0e8301

File content as of revision 3:e57684eb3556:

#include "mbed.h"
#include "TextLCD.h"
#include "LG1300L.h"

TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7

Serial pc(USBTX, USBRX); // tx, rx

I2C i2c(p28,p27);
DigitalOut LED (LED1);

int main() {
    LG1300L IMU(i2c, 2);

    while(1) {
        float angle = IMU.GetAngle();
        float ROT= IMU.GetROT();
        float X_ACC = IMU.GetACC_X();
        float Y_ACC = IMU. GetACC_Y();
        float Z_ACC = IMU. GetACC_Z();
        pc.printf("///////////////////////////////////\n");
        pc.printf("//ANGLE: %f\n", angle);
        pc.printf("//ROT: %f\n", ROT);
        pc.printf("//X-Axis: %f\n", X_ACC );
        pc.printf("//Y-Axis: %f\n", Y_ACC );
        pc.printf("//Z-axis: %f\n", Z_ACC );
        pc.printf("///////////////////////////////////\n");
        wait(1);
    }
}