From ab7020f718932371f11dc384909a5eee49e97734 Mon Sep 17 00:00:00 2001 From: mattbk Date: Mon, 9 Oct 2023 20:43:52 -0500 Subject: [PATCH] Simple test of voltage measurement. --- src/main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 45d96c3..5b722e3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,6 +31,11 @@ AsyncWebServer server(80); const int keyer = 32; 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 const int alarmPin = 4; // pin to monitor for RTC alarms @@ -616,6 +621,13 @@ void setup() { 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 // Check if alarm by polling SQW alarm pin if((yourInputSend == 2) & (digitalRead(alarmPin) == LOW)) {