Files
Last update 5 years 2 weeks
Filesesp32main | |
---|---|
.. | |
battery.cpp | |
battery.h | |
component.mk | |
config.h | |
console.cpp | |
console.h | |
main.cpp | |
motor.cpp | |
motor.h | |
peripherals.cpp | |
peripherals.h | |
radio.cpp | |
radio.h |
battery.cpp#include "battery.h" #include <driver/adc.h> esp_adc_cal_characteristics_t* adc_chars = nullptr; Battery::Battery() { } float Battery::read_voltage() const { auto adc_reading = adc1_get_raw((adc1_channel_t) ADC_CHANNEL_7); uint32_t voltage = esp_adc_cal_raw_to_voltage(adc_reading, adc_chars); return voltage * 0.010968279735; }