In the example of B3, the only way to see the results was to preview the image in the camera. Sometimes You need to have some other output of the system. So now, in our example, we use e-paper display attached to the system.
This hands-on lab guide is intended for the Beginners, but other target groups may benefit from it, treating it as a tool for advanced projects.
There are no other prerequisites than knowledge of e-paper library. Mind, the display is controlled by a specialised interface connected to selected GPIO ports of the system.
Initialise e-paper screen, clear it then write some fancy text on it, i.e. “Hello IOT!” in the first line.
As a result, the user can check the text displayed on the screen in the camera.
There are no special steps to be performed.
Include LCD driver library:
#include <SPI.h> #include <epd2in13.h> #include <epdpaint.h> #include "imagedata.h"
Choose uncolored verison display:
#define COLORED 0 #define UNCOLORED 1
Declare buffer for image and instantiate software controller component for the e-ink display:
unsigned char image[1024]; Paint paint(image, 0, 0); Epd epd;
Initialize display - we suggest to do it in setup() function:
… if (epd.Init(lut_full_update) != 0) { Serial.print("e-Paper init failed"); return; } …
Clear the contents, set cursor and draw static text - still in setup() function:
... epd.ClearFrameMemory(0xFF); // bit set = white, bit reset = black paint.SetRotate(ROTATE_0); paint.SetWidth(128); // width should be the multiple of 8 paint.SetHeight(24); ...
Place text “Hello IOT!” in frame buffer:
… /* For simplicity, the arguments are explicit numerical coordinates */ paint.Clear(UNCOLORED); paint.DrawStringAt(30, 4, "Hello IOT!", &Font12, UNCOLORED); epd.SetFrameMemory(paint.GetImage(), 0, 10, paint.GetWidth(), paint.GetHeight()); …
Display buffer“
... epd.DisplayFrame(); ...
The only way for validation is to check display by the camera.