-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c5dd9d
commit cedc6d1
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#include "M5CoreS3.h" | ||
|
||
void setup() | ||
{ | ||
auto cfg = M5.config(); | ||
// cfg.output_power = false; // if using ext power input(Grove Port or DC input power supply) needs to be set to | ||
// false. | ||
CoreS3.begin(cfg); | ||
CoreS3.Display.setTextSize(2); | ||
} | ||
|
||
void loop() | ||
{ | ||
CoreS3.Display.clear(); | ||
int bat_vol = CoreS3.Power.getBatteryVoltage(); | ||
CoreS3.Display.setCursor(10, 30); | ||
CoreS3.Display.printf("BAT: %dmv", bat_vol); | ||
int bat_level = CoreS3.Power.getBatteryLevel(); | ||
CoreS3.Display.setCursor(10, 50); | ||
CoreS3.Display.printf("BAT Level: %d", bat_level); | ||
delay(1000); | ||
} |