#include //E-paper SPI etc //EPD #include"EPD.h" //E-paper driver #include"IMAGE.h" //E-paper image data //BT #include "BluetoothSerial.h" #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it #endif BluetoothSerial SerialBT; char BT_RX_BUF[100]; //BT receive data char StringNum[100];// BT display data unsigned int DataLength;// Data length unsigned char ImageBW[EPD_ARRAY];//Define canvas space void setup() { /* ESP32-WROOM-32D (Using hardware SPI) BUSY——GPIO13 RES——GPIO12 DC——GPIO14 CS——GPIO27 SCK—GPIO18 SDIN—GPIO23 */ pinMode(13, INPUT); //BUSY pinMode(12, OUTPUT); //RES pinMode(14, OUTPUT); //DC pinMode(27, OUTPUT); //CS //SPI SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0)); SPI.begin (); //BT Serial.begin(115200); SerialBT.begin("ESP32test"); //Bluetooth device name Serial.println("The device started, now you can pair it with bluetooth!"); } //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 update. 3.Please make sue that EPD enters sleep mode when update 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() { unsigned char i; int num; EPD_HW_Init(); //Full screen update 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. //Send the following test data in hexadecimal format using Bluetooth debugging assistant //AA 55 E1 00 08 40 41 42 43 44 45 46 47 04 FF 0D 0A (40~47:@ABCDEFG ascii) /*AA 55: Data Header E1: Function Bit 00: Reserved 08: Data Length 40-47: Data Bit 04: Verification FF 0D 0A: Data Tail */ while(1) { if(SerialBT.available()) //Bluetooth data reception { BT_RX_BUF[num++]=SerialBT.read(); } if(BT_RX_BUF[16]==0x0A) //Determine the data tail { Serial.println("BT_RX_BUF[16]==0x0A"); //Get display data for(i=0;i