second commit

This commit is contained in:
2025-02-20 13:19:16 +08:00
commit 09256a1972
52 changed files with 8016 additions and 0 deletions

22
src/adc.cpp Normal file
View File

@ -0,0 +1,22 @@
#include "adc.h"
//电源电压测量
void adc_init()
{
pinMode(ADC_PIN,INPUT);
}
float adc_read()
{
float Value =0;
float power =0;
for(uint8_t i = 0; i < 10; i++)
{
Value = analogRead(ADC_PIN);
power += (Value * 3.3 / 4095.0) * 11;
}
power = power / 10.f + 0.51;
// write_log(log_path,"power: " + String(power),10);
return power;
}