//2 displays
//https://lastminuteengineers.com/esp32-pinout-reference/
/*
[ "esp:TX0", "$serialMonitor:RX", "", [] ],
[ "esp:RX0", "$serialMonitor:TX", "", [] ],
[ "esp:GND.1", "led1:C", "black", [ "v-0.1", "h66.9", "v19.2" ] ],
[ "led1:A", "r1:2", "green", [ "v0" ] ],
[ "esp:D15", "r1:1", "green", [ "h0" ] ],
[ "epd1:GND", "esp:GND.2", "black", [ "h-153.6", "v67.23" ] ],
[ "epd1:VCC", "esp:3V3", "red", [ "h-144", "v86.33", "h-57.3" ] ],
[ "epd1:DIN", "esp:D23", "green", [ "h-48", "v-38.57" ] ],
[ "esp:D18", "epd1:CLK", "green", [ "h18.9", "v-172.73" ] ],
[ "esp:D5", "epd1:CS", "green", [ "h28.5", "v-192" ] ],
[ "epd1:DC", "esp:D17", "blue", [ "h-38.4", "v-38.4", "h-297.6", "v115.5" ] ],
[ "esp:D26", "epd1:RST", "green", [ "h-28.8", "v-115.3", "h297.6", "v38.4" ] ],
[ "esp:D25", "epd1:BUSY", "green", [ "h-19.2", "v-115.2", "h297.6", "v38.4" ] ],
[ "esp:D27", "epd1:DC", "blue", [ "h-48", "v-115.5", "h307.2", "v38.4" ] ]
*/
//GxEPD2_BW<GxEPD2_290_T94_V2, GxEPD2_290_T94_V2::HEIGHT> display(GxEPD2_290_T94_V2(
// /*CS=*/5, /*DC=*/27, /*RST=*/26, /*BUSY=*/25
// // /*CS=*/ 5, /*DC=*/ 2, /*RST=*/ 0, /*BUSY=*/ 4
// )); // GDEM029T94 128x296, SSD1680, Waveshare 2.9" V2 variant
#define LED2 15
// *****************************************************************************************************
// HELLO WORLD: ESP32 on ePaper 2.90" 128x296 created: Dec.2023
// ============
//
// ESP32 ---> 2.13 inch e-paper SPI
// ePaper========>=====wokwi-esp32-devkit-v1
// BUSY -----> 25
// RST -----> 26
// DC MISO? -----> 27
// CS -----> 5
// CLK/SCK -----> 18
// DIN MOSI -----> 23
// GND -----> GND
// 3V3 -----> VCC
// *****************************************************************************************************
//
//nke
/*
"connections": [
[ "esp:TX", "$serialMonitor:RX", "", [] ],
[ "esp:RX", "$serialMonitor:TX", "", [] ],
[ "esp:GND.1", "led1:C", "black", [ "v-0.1", "h66.9", "v19.2" ] ],
[ "led1:A", "r1:2", "green", [ "v0" ] ],
[ "esp:D15", "r1:1", "green", [ "h0" ] ],
[ "epd1:GND", "esp:GND.2", "black", [ "h-153.6", "v67.23" ] ],
[ "epd1:VCC", "esp:3V3", "red", [ "h-144", "v86.33", "h-57.3" ] ],
[ "epd1:DIN", "esp:D23", "green", [ "h-48", "v-38.57" ] ], ==>MOSI 23
[ "esp:D18", "epd1:CLK", "green", [ "h18.9", "v-172.73" ] ],
[ "esp:D5", "epd1:CS", "green", [ "h28.5", "v-192" ] ],
[ "epd1:DC", "esp:D27", "green", [ "h-38.4", "v-38.4", "h-297.6", "v115.5" ] ],
[ "esp:D26", "epd1:RST", "green", [ "h-28.8", "v-115.3", "h297.6", "v38.4" ] ],
[ "esp:D25", "epd1:BUSY", "green", [ "h-19.2", "v-115.2", "h297.6", "v38.4" ] ]
],*/
#define CS 5 // 15 CS 5 pin# std.S3 10 (ESP32 5)
#define DC 27 //22 // 21 DC 22 pin# std.S3 14 (ESP32 2)
#define RSET 26 //21 // 22 RST 21 pin# std.S3 13 (ESP32 0)
#define BUSY 25 //4 // 23 BUSY 4 pin# std.S3 9 or 46 (ESP32 4)
#define MOSI 23 // 5 MOSI Data 23 HW pin# std.S3 11 (ESP32 23)
#define SCLK 18 // 4 CLK Clock 18 HW pin# std.S3 12 (ESP32 18)
#define MISO -1 // -1 MISO - pin# std.S3 - (ESP32 -)
//#define useGxEPDlib //WERKT NOG NIET MET GxEPD2
#ifdef useGxEPDlib
// ===== Versuch mit alter GxEPD.h library ===================================================================
#include <GxEPD.h>
#include <GxGDEM029T94/GxGDEM029T94.h>
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>
#include <SPI.h>
#include <Fonts/FreeMonoBold9pt7b.h>
//#include <Fonts/FreeMonoBold12pt7b.h>
GxIO_Class io(SPI, CS, DC, RSET); // GxIO_Class io(SPI, EPD_CS, EPD_DC, EPD_RSET);
GxEPD_Class display(io, RSET, BUSY); // GxEPD_Class display(io, EPD_RSET, EPD_BUSY);
// ====================================================================================================
//
#else
// ===== Versuch mit GxEPD2.h library ===================================================================
//#include <GxEPD2_BW.h>
#include <GxEPD2_3C.h>
//#include <GxEPD2_7C.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
//#include <Fonts/FreeSerif9pt7b.h>
#include <Adafruit_GFX.h> // Core graphics library
#include <SPI.h>
GxEPD2_3C<GxEPD2_290_C90c, GxEPD2_290_C90c::HEIGHT> display(GxEPD2_290_C90c(CS, DC, RST, BUSY)); // GDEM029C90 128x296, SSD1680
// ====================================================================================================
#endif
const char TextBsp[] = "Irgendein Text";
int cnt; // counter zum Testen des Beispiels mit alter GxEPD library
const char HelloWorld[] = "Hello World!";
void helloWorld()
{
//Serial.println("helloWorld");
display.setRotation(1);
display.setFont(&FreeMonoBold9pt7b);
display.setTextColor(GxEPD_BLACK);
int16_t tbx, tby; uint16_t tbw, tbh;
display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
// center bounding box by transposition of origin:
uint16_t x = ((display.width() - tbw) / 2) - tbx;
uint16_t y = ((display.height() - tbh) / 2) - tby;
// full window mode is the initial mode, set it anyway
display.setFullWindow();
display.fillScreen(GxEPD_WHITE);
display.setCursor(x, y);
display.print(HelloWorld);
display.display(false); // full update
//Serial.println("helloWorld done");
}
void setup()
{ Serial.begin(9600);
pinMode(LED2, OUTPUT);
#ifdef useGxEPDlib
Serial.println("Using GxEPDlib");
SPI.begin(SCLK, MISO, MOSI); // GxEPD library alt, Definition
display.init(); // alte und neue library, Initialisierung
//display.init(115200); // default 10ms reset pulse, e.g. for bare panels with DESPI-C02
//display.init(115200, true, 2, false); // USE THIS for Waveshare boards with "clever" reset circuit, 2ms reset pulse
#else
Serial.println(">>>>>>>>>>> Using GxEPD2");
display.init(115200, true, 2, false); // USE THIS for Waveshare boards with "clever" reset circuit, 2ms reset pulse
helloWorld();
delay(1000);
#endif
/*
display.setRotation(1);
display.fillScreen(GxEPD_WHITE);
display.setFont(&FreeMonoBold9pt7b);
display.setTextColor(GxEPD_BLACK);
int16_t tbx, tby; uint16_t tbw, tbh;
display.getTextBounds(TextBsp, 0, 0, &tbx, &tby, &tbw, &tbh);
// center the bounding box by transposition of the origin:
uint16_t x = ((display.width() - tbw) / 2) - tbx;
uint16_t y = ((display.height() - tbh) / 2) - tby;
// display.setFullWindow(); // wozu?
display.firstPage(); // variant with do... while
do
{ display.setCursor(x, y);
//display.print(TextBsp);
display.print("ein Blabla ");
//display.setFont(u8g2_font_helvB18_tf); // Set the font to Helvetica Bold 18
//display.setCursor(10, 10); // Set the cursor to the top left corner
//display.print("Hello, world!"); // Print
//display.setFont(u8g2_font_helvB12_tf); // Set the font to Helvetica Bold 12
//display.setCursor(20, 20); // Set the cursor to the second line
//display.print("Text in Setup()"); // Print
}
while (display.nextPage());
display.hibernate(); // original Zingg, what for?
Serial.println(TextBsp);
*/
}
void loop(){
digitalWrite(LED2, HIGH);
delay(500);
digitalWrite(LED2, LOW);
delay(500);
}
void loopxxx()
{ //
/*
display.setRotation(1);
display.fillScreen(GxEPD_WHITE);
display.setTextColor(GxEPD_BLACK);
display.setFont(&FreeMonoBold9pt7b);
display.setCursor(10, 30);
display.println("Hello World");
//display.setFont(&FreeMonoBold12pt7b);
display.printf("Loop Anzahl %d",cnt);
cnt++;
display.update();
delay(10000);
//
*/
/*
display.setRotation(1);
display.fillScreen(GxEPD_WHITE);
display.setTextColor(GxEPD_BLACK);
display.setFont(&FreeMonoBold9pt7b);
//display.setFont(&FreeMonoBold12pt7b);
display.setCursor(10, 20);
display.println("Text in Loop()");
display.display(); // Update the display
//display.update(); // nur GxEPD alt
Serial.print("im Loop()...");
delay(10000); // Wait before clearing the display and drawing again
*/
};
Let op voor wemos lolin ziet DC op GPIO17 ivp GPIO27