diff options
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); +} |
