update arduino/Betas/RGB_V1.1.1/main/main.ino.

master
慕炎 2022-01-19 01:04:02 +00:00 committed by Gitee
parent ba46b9f492
commit 40b2366ff7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 6 additions and 6 deletions

View File

@ -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;
}