ER2

Dependencies:   mbed Grove_LCD_RGB_Backlight

Revision:
0:5226382bd1c3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jun 02 07:19:57 2021 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+#include "Grove_LCD_RGB_Backlight.h"
+
+Grove_LCD_RGB_Backlight LCD(p28,p27);
+AnalogIn bat(p15);
+int main()
+{
+    LCD.setRGB(255, 255, 255);
+    float val;
+    char tab[20]= "Vbat =" ; //création d’une chaîne de caractères
+    while(1) {
+        LCD.clear();
+        char tab[20]= "Vbat =" ; //création d’une chaîne de caractères
+        val=bat.read( )*13.3 ; //lecture de la variable
+        sprintf(tab, "Vbat= %.2f V",val) ; //contenu de tab + val sous le format %.2f
+        LCD.print(tab) ; //affichage de la chaîne tab sur le LCD
+        wait(1);
+    }
+}