Final1x

Dependencies:   GYRO_DISCO_L476VG mbed BSP_DISCO_L476VG COMPASS_DISCO_L476VG

main.cpp

Committer:
bcostm
Date:
2015-09-24
Revision:
0:5432bdf904f9
Child:
5:f4a35a2a9085

File content as of revision 0:5432bdf904f9:

#include "mbed.h"
#include "GYRO_DISCO_L476VG.h"

GYRO_DISCO_L476VG gyro;

DigitalOut led1(LED1);

int main()
{
    float GyroBuffer[3];
  
    printf("Gyroscope started\n");
  
    while(1) {
        // Read Gyroscope values
        gyro.GetXYZ(GyroBuffer);
        // Display values      
        printf("X = %f\n", GyroBuffer[0]);
        printf("Y = %f\n", GyroBuffer[1]);
        printf("Z = %f\n", GyroBuffer[2]);
        printf("\033[3A"); // Moves cursor up x lines (x value is between [ and A)
        led1 = !led1;
        wait(1);
    }
}