Saturday, March 2, 2024

library – Get 3-inch e-Paper engaged on a Nano


Please assist!

I bought a 3-inch e-Paper Show from Waveshare, which appeared to swimsuit my mission properly. The exemplary little code to point out a picture was straightforward to arrange and to show performance:

#embody <SPI.h>
#embody "epd3in0g.h"
#embody "imagedata.h"

Epd epd;

void setup() {
  // put your setup code right here, to run as soon as:
  Serial.start(115200);
  Serial.print("e-Paper init ");
  if (epd.Init() != 0) {
      Serial.print("e-Paper init failed");
      return;
  }

  Serial.print("White rn");
  epd.Clear(white);
  delay(2000);

  epd.Init();
  Serial.print("Picture rn");
  epd.Show(IMAGE_DATA);
  delay(2000);

  epd.Init();
  Serial.print("Small Picture rn");
  epd.Display_part(IMAGE_DATA, 0 ,0, 168, 400);
  delay(2000);

  epd.Init();
  Serial.print("Clear...rn");
  epd.Clear(white);
  delay(2000);

  Serial.print("Goto Sleep...rn");
  epd.Sleep();
}

void loop() {

}

I can’t simply have photographs displayed, I goal for strings with textual content and numbers and people partial refreshed. Wild guesses if a

epd.Display_Text('''Hey World''');

would possibly work is pointless. Thus, the existence and utilization of doable instructions for the epd. seems to me not properly documented (or I used to be unable to seek out one thing even after a totally search).

I had a have a look at different examples utilizing GxEPD libraries and it appeared as place to begin for me.

Inside the GxEPD2 Library it appears a category for 3-inch EPD is lacking as it’s nowhere declared (I assume there must be one thing like a GxEPD_300 to set show dimensions and many others.).

So, I reckon I have to wrap up one thing to satisfy the specs of the 400×168 pixel show however I do not know the place to start out.

I attempted round with the GxEPD_MinimumExample.ino, like

  • changing the show particular lib with the epd3in0g.h from the instance
  • adjusted the proper pins in response to the Waveshare Wiki
// GxEPD_MinimumExample by Jean-Marc Zingg

#embody <GxEPD.h>

// choose the show class to make use of, just one, copy from GxEPD_Example
//#embody <GxGDEH0154D67/GxGDEH0154D67.h>  // 1.54" b/w -> from org. instance.
#embody "epd3in0g.h" //my 3-inch show

#embody <GxIO/GxIO_SPI/GxIO_SPI.h>
#embody <GxIO/GxIO.h>

// constructor for AVR Arduino, copy from GxEPD_Example else
GxIO_Class io(SPI, /*CS=*/ 10, /*DC=*/ 9, /*RST=*/ 8); // arbitrary choice of 8, 9 chosen for default of GxEPD_Class
GxEPD_Class show(io, /*RST=*/ 8, /*BUSY=*/ 7); // default choice of (9), 7

void setup()
{
  show.init();
  show.eraseDisplay();
  // remark out subsequent line to don't have any or minimal Adafruit_GFX code
  show.drawPaged(drawHelloWorld); // model for AVR utilizing paged drawing, works additionally on different processors
}

void drawHelloWorld()
{
  show.setTextColor(GxEPD_BLACK);
  show.print("Hey World!");
}

void loop() {};

Throughout the verification prior the add I get errors pointing again to the libs:

error: 'GxEPD_Class' doesn't title a sort; did you imply 'GxIO_Class'?*

I assume it is because the decision to provoke the show will not be working.

Thanks for any recommendation!

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles