ER2

Dependencies:   mbed Grove_LCD_RGB_Backlight

main.cpp

Committer:
dorian06
Date:
2021-06-02
Revision:
0:5226382bd1c3

File content as of revision 0:5226382bd1c3:

#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);
    }
}