This is an old revision of the document!


B3: E-paper display operations

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.

Target group

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.

Prerequisites

There are no other prerequisites than knowledge of e-paper library. Mind, the display is controlled by a specialized interface connected to selected GPIO ports of the system.

Scenario

Initialize e-paper screen, clear it then write some fancy text on it, i.e. “Hello IOT!” in the first line.

Result

As a result, the user can check the text displayed on the screen in the camera.

Start

Write starting conditions, i.e. what to do at the beginning, what to pay attention before beginning, how the mechanical part should look like, etc.

Steps

There are no special steps to be performed.

Step 1

Include LCD driver library:

#include <SPI.h>
#include <epd2in13.h>
#include <epdpaint.h>
#include "imagedata.h"
Step 2

Choose uncolored verison display:

#define COLORED     0
#define UNCOLORED   1
Step 3

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;
Step4

Initialize display - we suggest to do it in setup() function:

…
  if (epd.Init(lut_full_update) != 0) {
      Serial.print("e-Paper init failed");
      return;
  }
…
Step 5

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);
... 
Step 6

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());
…
Step 6

Display buffer“

...
  epd.DisplayFrame();
...

Result validation

The only way for validation is to check display by the camera.

en/iot-open/remotelab/sut/color/b3.1572353148.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0