Skip to content

Commit ec6039f

Browse files
committed
Add png draw example
1 parent da87be9 commit ec6039f

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
9.25 KB
Loading
4.94 KB
Loading
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Need to format SPIFFS the first time you run a
3+
test or else use the SPIFFS plugin to create a partition
4+
https://github.com/me-no-dev/arduino-esp32fs-plugin
5+
* put png file in (<project directory>/data)
6+
* Select Tools > ESP32 Sketch Data Upload menu item. This should start uploading the files into ESP32 flash file system.
7+
*/
8+
#include <M5Stack.h>
9+
10+
void setup()
11+
{
12+
M5.begin();
13+
M5.Power.begin();
14+
if(!SPIFFS.begin(true)){
15+
Serial.println("SPIFFS Mount Failed");
16+
return;
17+
}
18+
19+
M5.Lcd.drawPngFile(SPIFFS, "/test.png", 0, 0);
20+
}
21+
22+
void loop()
23+
{
24+
M5.update();
25+
if(M5.BtnA.wasPressed()) {
26+
M5.Lcd.drawPngFile(SPIFFS, "/test.png", 0, 0);
27+
}
28+
29+
if(M5.BtnB.wasPressed()) {
30+
M5.Lcd.drawPngFile(SPIFFS, "/test1.png", 0, 0);
31+
}
32+
}

0 commit comments

Comments
 (0)