Printing gyro measurement results on LCD screen

Dependencies:   LCD_DISCO_F429ZI mbed BSP_DISCO_F429ZI GYRO_DISCO_F429ZI

Revision:
4:3e78c8cfba95
Parent:
0:44f624c5501e
--- a/main.cpp	Tue Jul 04 15:49:49 2017 +0000
+++ b/main.cpp	Sun Oct 20 00:30:52 2019 +0000
@@ -1,5 +1,8 @@
 #include "mbed.h"
 #include "GYRO_DISCO_F429ZI.h"
+#include "LCD_DISCO_F429ZI.h"
+
+LCD_DISCO_F429ZI lcd;
 
 GYRO_DISCO_F429ZI gyro;
 
@@ -11,15 +14,35 @@
   
     printf("Gyroscope started\n");
   
+    BSP_LCD_SetFont(&Font20);
+  
+        lcd.Clear(LCD_COLOR_BLUE);
+        lcd.SetBackColor(LCD_COLOR_BLUE);
+        lcd.SetTextColor(LCD_COLOR_WHITE);
+       
+  
     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)
+        
+      // wait(0.3);
+      
+       
+        char xPos[18];
+        char yPos[18];
+        char zPos[128];
+        
+        int spRes = snprintf(xPos, 14,"X = %f\n", GyroBuffer[0] );
+        spRes = snprintf(yPos, 14,"Y = %f\n", GyroBuffer[1] );
+        spRes = snprintf(zPos, 14,"Z = %f\n", GyroBuffer[2] );
+      
+        lcd.DisplayStringAt(20, LINE(4), (uint8_t *)xPos, LEFT_MODE);
+        lcd.DisplayStringAt(20, LINE(5), (uint8_t *)yPos, LEFT_MODE);
+        lcd.DisplayStringAt(20, LINE(6), (uint8_t *)zPos, LEFT_MODE);
+               
+        wait_ms(250);
         led1 = !led1;
-        wait(1);
+        
     }
 }