Files
smart-serow/arduino/main/voltage.h

23 lines
516 B
C
Raw Normal View History

2026-01-25 19:05:17 +09:00
#ifndef VOLTAGE_H
#define VOLTAGE_H
#include <Arduino.h>
// Initialize voltage monitoring (call in setup)
void voltage_init();
// Set smoothing window size (1-32 samples, default 20)
// Resets the buffer with current reading
void voltage_set_smoothing(int windowSize);
// Read battery voltage (smoothed), returns volts (e.g., 12.5)
2026-01-25 19:05:17 +09:00
float voltage_read();
// Read smoothed ADC value (averaged over window)
int voltage_read_smoothed();
// Read raw ADC value (0-1023), no smoothing
2026-01-25 19:05:17 +09:00
int voltage_read_raw();
#endif