mirror of
https://github.com/m5stack/M5Stack.git
synced 2026-05-20 10:06:46 -07:00
Add png draw example
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Need to format SPIFFS the first time you run a
|
||||
test or else use the SPIFFS plugin to create a partition
|
||||
https://github.com/me-no-dev/arduino-esp32fs-plugin
|
||||
* put png file in (<project directory>/data)
|
||||
* Select Tools > ESP32 Sketch Data Upload menu item. This should start uploading the files into ESP32 flash file system.
|
||||
*/
|
||||
#include <M5Stack.h>
|
||||
|
||||
void setup()
|
||||
{
|
||||
M5.begin();
|
||||
M5.Power.begin();
|
||||
if(!SPIFFS.begin(true)){
|
||||
Serial.println("SPIFFS Mount Failed");
|
||||
return;
|
||||
}
|
||||
|
||||
M5.Lcd.drawPngFile(SPIFFS, "/test.png", 0, 0);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
M5.update();
|
||||
if(M5.BtnA.wasPressed()) {
|
||||
M5.Lcd.drawPngFile(SPIFFS, "/test.png", 0, 0);
|
||||
}
|
||||
|
||||
if(M5.BtnB.wasPressed()) {
|
||||
M5.Lcd.drawPngFile(SPIFFS, "/test1.png", 0, 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user