From 2b2362b52e79ce102088c690e2bbcc595563c859 Mon Sep 17 00:00:00 2001 From: Embedded Innovation Date: Mon, 2 Oct 2017 20:44:30 +0200 Subject: [PATCH] Fix calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Datasheet says: “The ADC converts an analog input voltage to a 10-bit digital value through successive approximation. The minimum value represents GND and the maximum value represents the voltage on the AREF pin minus 1 LSB.” --- Vcc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vcc.cpp b/Vcc.cpp index 181900d..8dbcbe3 100644 --- a/Vcc.cpp +++ b/Vcc.cpp @@ -58,7 +58,7 @@ float Vcc::Read_Volts(void) // Result is now stored in ADC. // Calculate Vcc (in V) - float vcc = 1.1*1023.0 / ADC; + float vcc = 1.1*1024.0 / ADC; // Apply compensation vcc *= m_correction;