From 9c30b42e77f9c3a519f98e19e2eabe0aaf91e9d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Tue, 28 Feb 2023 13:27:23 +0100 Subject: [PATCH] finish reading voltage --- solar_panel.X/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/solar_panel.X/main.c b/solar_panel.X/main.c index 5c912bc..ad5b932 100644 --- a/solar_panel.X/main.c +++ b/solar_panel.X/main.c @@ -44,6 +44,7 @@ #include "mcc_generated_files/mcc.h" #include "lcd/lcd.h" +#define MAX_COL 16 /* Main application */ @@ -75,9 +76,11 @@ void main(void) float value; value =(float)( ADC_GetConversion(voltage)/19.859); - char msg[16]; - sprintf(msg, "Value : %3.1f mV", value); - // LCD_2x16_WriteCmd(0x01); // clear display + char msg[MAX_COL+1]; + + snprintf(msg, MAX_COL+1, "Value : %3.1f mV ", value); + + //LCD_2x16_WriteCmd(0x01); // clear display LCD_2x16_WriteMsg(msg,0);