first commit
This commit is contained in:
commit
5893b00dd2
1669 changed files with 1982740 additions and 0 deletions
38
sketch_learning_drawing/sketch_learning_drawing.ino
Normal file
38
sketch_learning_drawing/sketch_learning_drawing.ino
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include <M5Unified.h>
|
||||
static int32_t batteryLevel;
|
||||
static int16_t batteryVoltage;
|
||||
static int32_t oldBatteryLevel;
|
||||
static int16_t oldBatteryVoltage;
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
M5.begin();
|
||||
M5.Display.setRotation(0);
|
||||
M5.Display.setFont(&fonts::FreeMonoBold18pt7b);
|
||||
M5.Display.setEpdMode(epd_text); // epd_quality, epd_text, epd_fast, epd_fastest
|
||||
M5.Display.clear();
|
||||
|
||||
M5.Display.setCursor(0, 200);
|
||||
M5.Display.println(" Paper Realtime");
|
||||
M5.Display.println(" Battery Status\n\n");
|
||||
M5.Display.println(" Battery Level:\n");
|
||||
M5.Display.println(" Battery Voltage:\n");
|
||||
batteryLevel = M5.Power.getBatteryLevel();
|
||||
batteryVoltage = M5.Power.getBatteryVoltage();
|
||||
oldBatteryLevel = -1;
|
||||
oldBatteryVoltage = -1;
|
||||
}
|
||||
|
||||
void loop() {
|
||||
M5.update();
|
||||
if (batteryLevel != oldBatteryLevel){
|
||||
M5.Display.setCursor(360, 340);
|
||||
M5.Display.printf(" %3d %%", batteryLevel);
|
||||
}
|
||||
if (batteryVoltage != oldBatteryVoltage) {
|
||||
M5.Display.setCursor(360, 410);
|
||||
M5.Display.printf("%4d mV", batteryVoltage);
|
||||
}
|
||||
oldBatteryLevel = batteryLevel;
|
||||
oldBatteryVoltage = batteryVoltage;
|
||||
delay(2000);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue