From 6202c75770cffe9fbe93c705b3dbdd0437f9a7c2 Mon Sep 17 00:00:00 2001 From: abp1g20 <abp1g20@soton.ac.uk> Date: Wed, 4 May 2022 14:06:55 +0000 Subject: [PATCH] Replace main.c --- main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 6186d55..4911d2f 100644 --- a/main.c +++ b/main.c @@ -33,11 +33,11 @@ int main() { //Update temperature display every second //Infinite loop - while(1) { - uint16_t raw = adc_read(); //Define a variable to store the raw output value from the adc + while (1) { + uint16_t raw = adc_read(); //Define a variable to store the raw output value from the adc //Do the conversion - const float conversion = 3.3f / (1<<12); + const float conversion = 3.3f / (1 << 12); float voltage = raw * conversion; // convert raw value to voltage float temperature = 27 - (voltage - 0.706) / 0.001721; // convert voltage to temperature value @@ -52,3 +52,4 @@ int main() { //wait 1 sec sleep_ms(1000); } +} -- GitLab