From 25d877362839a1a4e55d907a3067583351b901d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Fri, 24 Feb 2023 15:09:43 +0100 Subject: [PATCH] value in mV #TODO fix ghost caractere when under100 mV --- solar_panel.X/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/solar_panel.X/main.c b/solar_panel.X/main.c index f217874..5c912bc 100644 --- a/solar_panel.X/main.c +++ b/solar_panel.X/main.c @@ -72,11 +72,12 @@ void main(void) while (1) { - uint16_t value; + float value; - value = ADC_GetConversion(voltage); - char* msg; - sprintf(msg, "%i", value); + value =(float)( ADC_GetConversion(voltage)/19.859); + char msg[16]; + sprintf(msg, "Value : %3.1f mV", value); + // LCD_2x16_WriteCmd(0x01); // clear display LCD_2x16_WriteMsg(msg,0);