From 40b2366ff7f0d7bcfbd6407fcc1601849409183f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=85=95=E7=82=8E?= <29385962@qq.com> Date: Wed, 19 Jan 2022 01:04:02 +0000 Subject: [PATCH] update arduino/Betas/RGB_V1.1.1/main/main.ino. --- arduino/Betas/RGB_V1.1.1/main/main.ino | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arduino/Betas/RGB_V1.1.1/main/main.ino b/arduino/Betas/RGB_V1.1.1/main/main.ino index 13fb914..c0d0888 100644 --- a/arduino/Betas/RGB_V1.1.1/main/main.ino +++ b/arduino/Betas/RGB_V1.1.1/main/main.ino @@ -1232,20 +1232,20 @@ void addGlitter( fract8 chanceOfGlitter) double return_voltage_value(int pin_no) { - double tmp = 0; - double ADCVoltage = 0; - double inputVoltage = 0; + double tmp; + double ADCVoltage; + double inputVoltage; for (int i = 0; i < 20; i++) { - ADCVoltage = analogReadMilliVolts(pin_no) / 1000; + ADCVoltage = analogReadMilliVolts(pin_no) / 1000.0; inputVoltage = (ADCVoltage * R1_VOLTAGE) / R2_VOLTAGE; tmp = tmp + inputVoltage + ADCVoltage; // formula for calculating voltage in i.e. GND } inputVoltage = tmp / 20; if(inputVoltage!=0) - inputVoltage = inputVoltage + 0.165; + inputVoltage = inputVoltage + 0.001; return inputVoltage; } @@ -1270,4 +1270,4 @@ void touchAttach(int touchID, uint8_t touchPin) { touch_touching_time[touchID] = 0; //持续触摸时间清零 touchDetected[touchID] = 0; //持续触摸计数清零 } -} +} \ No newline at end of file