Simple test of voltage measurement.

This commit is contained in:
mattbk 2023-10-09 20:43:52 -05:00
parent 52b910ed79
commit ab7020f718

View File

@ -31,6 +31,11 @@ AsyncWebServer server(80);
const int keyer = 32; const int keyer = 32;
const int blinker = LED_BUILTIN; const int blinker = LED_BUILTIN;
// Battery voltage monitor
const int voltage_pin = 33;
int voltage_pin_value = 0;
// RTC connections
RTC_DS3231 rtc; // set up RTC RTC_DS3231 rtc; // set up RTC
const int alarmPin = 4; // pin to monitor for RTC alarms const int alarmPin = 4; // pin to monitor for RTC alarms
@ -616,6 +621,13 @@ void setup() {
void loop() { void loop() {
// For testing, print the value returned from the voltage circuit.
// This is not voltage, and needs to be scaled to the battery. See KB1OIQ's solution.
voltage_pin_value = analogRead(voltage_pin);
Serial.println(voltage_pin_value);
// This statement from https://github.com/garrysblog/DS3231-Alarm-With-Adafruit-RTClib-Library/blob/master/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired.ino // This statement from https://github.com/garrysblog/DS3231-Alarm-With-Adafruit-RTClib-Library/blob/master/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired/DS3231-RTClib-Adafruit-Alarm-Poll-alarmFired.ino
// Check if alarm by polling SQW alarm pin // Check if alarm by polling SQW alarm pin
if((yourInputSend == 2) & (digitalRead(alarmPin) == LOW)) { if((yourInputSend == 2) & (digitalRead(alarmPin) == LOW)) {