@yellowelise
You have to do / when referencing the root in Arduino SD libraries..
I've modified your example to output to the screen instead of serial and fixed it for you.. (I left the syntactically redundant exists, try create anyways, exists code in as that's what the original example did, it probably needs another if)
#include <M5EPD.h>
M5EPD_Canvas canvas(&M5.EPD);
File myFile;
void setup(void)
{
M5.begin();
M5.EPD.SetRotation(90);
M5.EPD.Clear(true);
M5.RTC.begin();
canvas.createCanvas(540, 400);
canvas.setTextSize(3);
bool ret = SD.begin(4, SPI, 20000000);
if(ret == false)
canvas.drawString("SD ERROR...", 45, 100);
else
{
canvas.drawString("SD OK...", 45, 100);
if (SD.exists("/screen.txt"))
canvas.drawString("Screen.txt Exists...", 45, 150);
else
canvas.drawString("Screen.txt Not Exists...", 45, 150);
canvas.drawString("Try create Screen.txt", 45, 200);
myFile = SD.open("/screen.txt", FILE_WRITE);
myFile.println("Some text...");
myFile.close();
if (SD.exists("/screen.txt"))
canvas.drawString("Screen.txt Exists...", 45, 250);
else
canvas.drawString("Screen.txt Still Not Exists...", 45, 250);
}
canvas.pushCanvas(0,0,UPDATE_MODE_DU4);
}
void loop(void)
{
}