Final1x

Dependencies:   GYRO_DISCO_L476VG BSP_DISCO_L476VG COMPASS_DISCO_L476VG

Committer:
bcostm
Date:
Thu Sep 24 06:57:01 2015 +0000
Revision:
0:5432bdf904f9
Child:
5:f4a35a2a9085
Initial version.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:5432bdf904f9 1 #include "mbed.h"
bcostm 0:5432bdf904f9 2 #include "GYRO_DISCO_L476VG.h"
bcostm 0:5432bdf904f9 3
bcostm 0:5432bdf904f9 4 GYRO_DISCO_L476VG gyro;
bcostm 0:5432bdf904f9 5
bcostm 0:5432bdf904f9 6 DigitalOut led1(LED1);
bcostm 0:5432bdf904f9 7
bcostm 0:5432bdf904f9 8 int main()
bcostm 0:5432bdf904f9 9 {
bcostm 0:5432bdf904f9 10 float GyroBuffer[3];
bcostm 0:5432bdf904f9 11
bcostm 0:5432bdf904f9 12 printf("Gyroscope started\n");
bcostm 0:5432bdf904f9 13
bcostm 0:5432bdf904f9 14 while(1) {
bcostm 0:5432bdf904f9 15 // Read Gyroscope values
bcostm 0:5432bdf904f9 16 gyro.GetXYZ(GyroBuffer);
bcostm 0:5432bdf904f9 17 // Display values
bcostm 0:5432bdf904f9 18 printf("X = %f\n", GyroBuffer[0]);
bcostm 0:5432bdf904f9 19 printf("Y = %f\n", GyroBuffer[1]);
bcostm 0:5432bdf904f9 20 printf("Z = %f\n", GyroBuffer[2]);
bcostm 0:5432bdf904f9 21 printf("\033[3A"); // Moves cursor up x lines (x value is between [ and A)
bcostm 0:5432bdf904f9 22 led1 = !led1;
bcostm 0:5432bdf904f9 23 wait(1);
bcostm 0:5432bdf904f9 24 }
bcostm 0:5432bdf904f9 25 }