Guest User

Arduino UNO ePaper example #BastlirskyPokec

a guest
Sep 29th, 2020
158
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // GxEPD_MinimumExample by Jean-Marc Zingg
  2.  
  3. #include <GxEPD.h>
  4. #include <Fonts/FreeMonoBold9pt7b.h>
  5.  
  6. // select the display class to use, only one, copy from GxEPD_Example
  7. //#include <GxGDEH0154D67/GxGDEH0154D67.h>  // 1.54" b/w
  8. #include <GxGDEW042Z15/GxGDEW042Z15.h>    // 4.2" b/w/r
  9.  
  10. #include <GxIO/GxIO_SPI/GxIO_SPI.h>
  11. #include <GxIO/GxIO.h>
  12.  
  13. // constructor for AVR Arduino, copy from GxEPD_Example else
  14. GxIO_Class io(SPI, /*CS=*/ 10, /*DC=*/ 9, /*RST=*/ 8); // arbitrary selection of 8, 9 selected for default of GxEPD_Class
  15. GxEPD_Class display(io, /*RST=*/ 8, /*BUSY=*/ 7); // default selection of (9), 7
  16.  
  17.  
  18. const char* name = "FreeMonoBold12pt7b";
  19. const GFXfont* f = &FreeMonoBold12pt7b;
  20.  
  21.  
  22. void setup()
  23. {
  24.   Serial.begin(115200);
  25.   Serial.println("Start init...");
  26.   display.init();
  27.   display.setRotation(2);
  28.   Serial.println("Erase display...");
  29.   display.eraseDisplay();
  30.   // comment out next line to have no or minimal Adafruit_GFX code
  31.   Serial.println("Draw Hello World...");
  32.   display.drawPaged(drawHelloWorld); // version for AVR using paged drawing, works also on other processors
  33.   Serial.println("Finished!");
  34.  
  35. }
  36.  
  37. void drawHelloWorld()
  38. {
  39.   display.setFont(f);
  40.   display.setTextColor(GxEPD_BLACK);
  41.   display.setCursor(0,20);
  42.   display.print("Bastlirsky pokec");
  43.   display.setTextColor(GxEPD_RED);
  44.   display.setCursor(0,40);
  45.   display.print("ePaper Special");
  46.  
  47. }
  48.  
  49. void loop() {};
RAW Paste Data