Skip to content

Commit 3727ac9

Browse files
committed
Add jpg bmp spiffs lcd draw example
1 parent 287b1b4 commit 3727ac9

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* You only 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 jpg or bmp 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+
9+
#include "FS.h"
10+
#include "SPIFFS.h"
11+
#include "M5Stack.h"
12+
13+
void setup(){
14+
M5.begin(true, false, false, false);
15+
Serial.begin(115200);
16+
if(!SPIFFS.begin(true)){
17+
Serial.println("SPIFFS Mount Failed");
18+
return;
19+
}
20+
M5.Lcd.drawJpgFile(SPIFFS, "/m5_logo.jpg", 0, 0);
21+
}
22+
23+
void loop(){
24+
M5.update();
25+
if(M5.BtnA.wasPressed()) {
26+
M5.Lcd.drawBmpFile(SPIFFS, "/pcd.bmp", 0, 0);
27+
}
28+
if(M5.BtnB.wasPressed()) {
29+
M5.Lcd.drawJpgFile(SPIFFS, "/m5_logo.jpg", 0, 0);
30+
}
31+
}
22.2 KB
Loading
Binary file not shown.

0 commit comments

Comments
 (0)