#include <DHT.h>
#include <GxEPD.h>
#include <GxGDEH029A1/GxGDEH029A1.h>
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>
#include <SPI.h>

#define DHTPIN 2
#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE);

GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ 3, /*RST=*/ 4); // Setup e-paper display pins
GxEPD_Class display(io, /*RST=*/ 4, /*BUSY=*/ 5); // Initialize e-paper display

void setup() {
  Serial.begin(9600);
  dht.begin();
  display.init();
}

void loop() {
  float humidity = dht.readHumidity();
  float temperature = dht.readTemperature();

  display.setRotation(1); // Set e-paper display rotation

  display.fillScreen(GxEPD_WHITE); // Clear screen
  display.setTextColor(GxEPD_BLACK); // Set text color
  display.setFont(FreeMono12pt7b); // Set font

  // Print temperature and humidity
  display.setCursor(10, 30);
  display.print("Temperature: ");
  display.print(temperature);
  display.print(" *C");

  display.setCursor(10, 60);
  display.print("Humidity: ");
  display.print(humidity);
  display.print(" %");

  display.update(); // Update e-paper display

  delay(5000); // Wait for 5 seconds before updating again
}
Loading
epaper-2in9