Skip to content

Commit 40d73b2

Browse files
committed
Create Arduino_PiCowbell_Doubler_Battery_Monitor.ino
1 parent 45500df commit 40d73b2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// SPDX-FileCopyrightText: 2024 Limor Fried for Adafruit Industries
2+
//
3+
// SPDX-License-Identifier: MIT
4+
5+
#define LED LED_BUILTIN
6+
7+
void setup() {
8+
Serial.begin(115200);
9+
// while (!Serial) delay(1); // wait for serial port
10+
pinMode(LED, OUTPUT);
11+
delay (100);
12+
Serial.println("PiCowbell Doubler Battery Monitor");
13+
14+
}
15+
16+
void loop() {
17+
digitalWrite(LED, HIGH);
18+
// get the on-board voltage
19+
float vsys = analogRead(A3) * 3 * 3.3 / 1023.0;
20+
Serial.printf("Vsys: %0.1f V", vsys);
21+
Serial.println();
22+
23+
digitalWrite(LED, LOW);
24+
delay(5000);
25+
}

0 commit comments

Comments
 (0)