Final1x
Dependencies: GYRO_DISCO_L476VG BSP_DISCO_L476VG COMPASS_DISCO_L476VG
Diff: main.cpp
- Revision:
- 0:5432bdf904f9
- Child:
- 5:f4a35a2a9085
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 24 06:57:01 2015 +0000 @@ -0,0 +1,25 @@ +#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); + } +}