3Axis gyro sensor sample. target sensor: L3GD20(ST)

Dependencies:   mbed

main.cpp

Committer:
satoshi1204
Date:
2018-12-18
Revision:
1:191e963655c2
Parent:
0:a1d1374eea97

File content as of revision 1:191e963655c2:

#include "mbed.h"
#include "L3GD20.h"

DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);
L3GD20 gyro(p9, p10);

int main() {
    while(1) {
        myled = 1;
        wait(0.2);
        double x, y, z;
        gyro.readData(x, y, z);
        pc.printf("%5.4lf %5.4lf %5.4lf\r\n", x, y, z);
        myled = 0;
        wait(0.2);
    }
}