epd4in2
A Node.js package for the 4.2inch e-Paper waveshare display on a Raspberry Pi 2/3/zero, forked from williwasser's epd7x5 Node.js package
Dependencies
- WiringPi for GPIO access of Raspberry Pi
- libgd2 for text output and drawing
Installation
Enable the SPI interface on Raspberry Pi: sudo raspi-config
WiringPi: follow installation on wiringpi.com
libgd2: sudo apt-get install libgd2-dev # libgd
epd4in2: npm install epd4in2
Usage example
const epd = const font = '/home/pi/bauhaus.ttf';const fontSize = 26 { await epd; let img = await epd; img let xll yll xlr ylr xur yur xul yul = img // Center the message img img await epd; await epd;}
The module exports the following functions and constants:
Functions:
epd.init()
epd.getImageBuffer('landscape')
Use landscape
to get a buffer oriented in landscape mode.
epd.displayImageBuffer(img)
epd.clear()
Equivalent to push a white image
epd.sleep()
Put the display in sleep mode. init
is required to come back to operations.
Constants:
epd.colors.white
epd.colors.black
epd.width
epd.height
gd namespace for access of functions on the gd object:
epd.gd
example: epd.gd.createFromFile(path)
to open an image
Documentation of node-gd functions can be found here
License
Apache 2.0