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 return_voltage_value(int pin_no)
{ {
double tmp = 0; double tmp;
double ADCVoltage = 0; double ADCVoltage;
double inputVoltage = 0; double inputVoltage;
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
{ {
ADCVoltage = analogReadMilliVolts(pin_no) / 1000; ADCVoltage = analogReadMilliVolts(pin_no) / 1000.0;
inputVoltage = (ADCVoltage * R1_VOLTAGE) / R2_VOLTAGE; inputVoltage = (ADCVoltage * R1_VOLTAGE) / R2_VOLTAGE;
tmp = tmp + inputVoltage + ADCVoltage; // formula for calculating voltage in i.e. GND tmp = tmp + inputVoltage + ADCVoltage; // formula for calculating voltage in i.e. GND
} }
inputVoltage = tmp / 20; inputVoltage = tmp / 20;
if(inputVoltage!=0) if(inputVoltage!=0)
inputVoltage = inputVoltage + 0.165; inputVoltage = inputVoltage + 0.001;
return inputVoltage; return inputVoltage;
} }
@ -1270,4 +1270,4 @@ void touchAttach(int touchID, uint8_t touchPin) {
touch_touching_time[touchID] = 0; //持续触摸时间清零 touch_touching_time[touchID] = 0; //持续触摸时间清零
touchDetected[touchID] = 0; //持续触摸计数清零 touchDetected[touchID] = 0; //持续触摸计数清零
} }
} }