diff options
| author | Yuval Adam <_@yuv.al> | 2026-01-15 09:08:54 +0100 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2026-01-15 09:08:54 +0100 |
| commit | fd7c017a6fab43eb1e6fbc39a36b716359a4dc29 (patch) | |
| tree | efd1b38ed2a0054fe4c1bbbcab6a32c64306e5c6 /hello-t-energy-s3.ino | |
Initial test setup
Diffstat (limited to 'hello-t-energy-s3.ino')
| -rw-r--r-- | hello-t-energy-s3.ino | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/hello-t-energy-s3.ino b/hello-t-energy-s3.ino new file mode 100644 index 0000000..fd0a05d --- /dev/null +++ b/hello-t-energy-s3.ino @@ -0,0 +1,21 @@ +// Minimal T-Energy-S3 test +// Reads battery voltage and prints to USB serial + +#define BATTERY_PIN 3 + +void setup() { + Serial.begin(115200); + delay(2000); // Wait for USB CDC to initialize + + Serial.println("Hello T-Energy-S3!"); + + pinMode(BATTERY_PIN, INPUT); + analogReadResolution(12); + analogSetPinAttenuation(BATTERY_PIN, ADC_11db); +} + +void loop() { + int mv = analogReadMilliVolts(BATTERY_PIN) * 2; // Voltage divider on board + Serial.printf("Battery: %d mV\n", mv); + delay(2000); +} |
