//Most Important Import #include #include "Display_EPD_W21_spi.h" #include "Display_EPD_W21.h" #include "frame.h" #include "GUI_Paint.h" #include "font.h" #if 1 unsigned char BlackImage[EPD_ARRAY]; //Define canvas space #endif //Most Important Part void setup() { pinMode(D5, INPUT); //BUSY pinMode(D0, OUTPUT); //RES pinMode(D3, OUTPUT); //DC pinMode(D1, OUTPUT); //CS //SPI SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); SPI.begin(); Serial.begin(9600); Serial.print(111); } //Tips// /* 1.Flickering is normal when EPD is performing a full screen update to clear ghosting from the previous image so to ensure better clarity and legibility for the new image. 2.There will be no flicker when EPD performs a partial refresh. 3.Please make sue that EPD enters sleep mode when refresh is completed and always leave the sleep mode command. Otherwise, this may result in a reduced lifespan of EPD. 4.Please refrain from inserting EPD to the FPC socket or unplugging it when the MCU is being powered to prevent potential damage.) 5.Re-initialization is required for every full screen update. 6.When porting the program, set the BUSY pin to input mode and other pins to output mode. */ void loop() { Serial.print(111); #if 1 //Partial refresh demostration. EPD_Init_Fast(); //Full screen refresh initialization. EPD_WhiteScreen_White(); //Clear screen function. EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. delay(2000); //Delay for 2s. //Partial refresh demo support displaying a clock at 5 locations with 00:00. If you need to perform partial refresh more than 5 locations, please use the feature of using partial refresh at the full screen demo. //After 5 partial refreshes, implement a full screen refresh to clear the ghosting caused by partial refreshes. //////////////////////Partial refresh time///////////////////////////////////// Paint_NewImage(BlackImage, EPD_WIDTH, EPD_HEIGHT, 0, WHITE); //Set canvas parameters, GUI image rotation, please change 0 to 0/90/180/270. Paint_SelectImage(BlackImage); //Select current settings. EPD_Init(); //Full screen refresh initialization. Paint_Clear(WHITE); //Clear canvas. const char * Message = "Welcome to Kalisto"; Paint_DrawString_EN(400 - (((strlen(Message) * 32) / 2)), 240 - (64 / 2), Message, & Font64, WHITE, BLACK); EPD_Display(BlackImage); //Display GUI image. EPD_DeepSleep(); //EPD_DeepSleep,Sleep instruction is necessary, please do not delete!!! delay(20000); //Delay for 2s. // Full screen update clear the screen. EPD_Init(); //Full screen refresh initialization. EPD_WhiteScreen_White(); //Clear screen function. EPD_DeepSleep(); //Enter the sleep mode and please do not delete it, otherwise it will reduce the lifespan of the screen. delay(2000); //Delay for 2s. #endif delay(300000); // The program stops here }