epaper
Coming soon: support for displaying images (from SD card)
Node.js library for the 4.3 Inch E-Paper display by Waveshare
Install
This project uses serialport, before you install this libary, please have a look at this section of the serialport readme: https://www.npmjs.com/package/serialport#installation-instructions
Installing epaper module:
npm install epaper
Sample Code
Assuming you have the e-paper displayed connected to /dev/cu.usbserial
:
const Display = Display;const display = '/dev/cu.usbserial' true; display ;
Methods
Utilities
Handshake
After the epaper has powered up, you can send the handshake command to make sure whether the terminal is ready and able to receive commands or data.
Clear
Clears the screen using the background color
Update
Used to refresh and update the display (clears then displays). All the commands sent in the session will be displayed.
Set Color
Sets the foreground and background color of the drawing. The foreground color is used in the display the basic drawings and text. The background color is used for the cleared screen.
Colors
The colors can be referenced as static variables on the Display object.
Display.WHITE
Display.GRAY
Display.DARK_GRAY
Display.BLACK
Draw
Pixel
Line
Draws a line with the 2 given points (X1, Y1 > X2, Y2).
Rectangle
Draws a rectangle with the two given points (opposite corners)
Filled Rectangle
Circle
Draws a circle with the given point (X, Y) being the center and the third parameter being the radius.
Filled Circle
Trangle
Draws a triangle using the three points given.
Filled Triangle
Text
Set Font
Fonts
The fonts can be referenced as static varibles on the Display object.
English:
ASCII32
ASCII48
ASCII64
Chinese
GBK32
GBK48
GBK64
Display Text
Displays a provided string at the given location using the current forground color and font. Maximum lentgh is 1020 bytes.
;
Resources
- Waveshare product website: http://www.waveshare.com/4.3inch-e-paper.htm
- E-paper product manual: http://www.waveshare.com/wiki/4.3inch_e-Paper#How_to_work_with_PC