From cac77a29c68c093bb29478c5eff530f2e9564baa Mon Sep 17 00:00:00 2001 From: "Wolfgang (Wolle) Ewald" Date: Sat, 15 Aug 2020 12:05:01 +0200 Subject: Add files via upload --- src/ADS1115_WE.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ADS1115_WE.cpp b/src/ADS1115_WE.cpp index 6ccd3f4..c07b610 100644 --- a/src/ADS1115_WE.cpp +++ b/src/ADS1115_WE.cpp @@ -179,7 +179,7 @@ int16_t ADS1115_WE::getResultWithRange(int16_t min, int16_t max, int16_t maxMill int16_t rawResult = readRegister(ADS1115_CONV_REG); int16_t result = 0; result = map(rawResult, -32767, 32767, min, max); - result = (int16_t) (1.0 * result * voltageRange / maxMillivolt); + result = (int16_t) ((1.0 * result * voltageRange / maxMillivolt) + 0.999); return result; } -- cgit v1.2.3