npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gpio-hd44780-driver

v0.1.1

Published

GPIO driver for the HD44780 LCD display

Downloads

10

Readme

This a Node.js module for using an LCD panel with a HD44780 LCD controller. It is intended to be used in projects that require LCD output and abstracts the setup and operation of the LCD. This module assumes you are running on hardware with a General Purpose (GPIO) interface such as a Raspberry Pi. Other hardware platforms are supported if they are supported by the rpio module.

The HD44780 must be wired in the 4-bit data mode configuration (i.e DB4 - DB7 are connected and DB0 - DB3 are not). In addition, the Read/Write signal (R/W) must be pulled low. The R/W signal is not used by the driver.

gpio-hd44780-driver is intended to be used with Node.js version 8 and higher.

Installation

npm install gpio-hd44780-driver

You must have the appropriate packages installed so your platform can compile drivers used by the rpio module.

API

gpio-hd44780-driver({config})

Creates a new gpio-hd44780-driver object and intializes the hardware. When the constructor returns, the HD44780 is ready to accept commands for controlling the display.

The config object is required and has the following options:

const config = {
  pinRs: 18,                  /* physical pin connected to the HD44780's register select pin */
  pinEnable: 22,              /* physical pin connected to the HD44780's enable pin */
  pinsData: [11, 12, 15, 16], /* physical pins connected to the HD44780's data bus (DB4 - DB7) */
  lcdColumns: 16,             /* the number of columns on the LCD panel */
  lcdRows: 2                  /* the number of rows on the LCD panel */
}

All options are required.

clear()

Clears the LCD panel and resets the cursor position to 0,0. This function takes some time for the HD44780 to complete and it has a built-in 100 msec delay.

print(str)

Sends a string to be displayed on the LCD. A \n in the string will cause the cursor to shift to the start of the next row.

Example

/* shows "Hello!" on the LCD */
lcd.print('Hello!');

/* shows "Hello" on the first row and "World!" on the second row */
lcd.print('Hello\nWorld!');

setCursor(col, row)

Explicitly sets the cursor position.

Usage

The following script can be used to print the words HD44780 Test! on the LCD panel:

const hd44780 = require('gpio-hd44780-driver');

const lcd = hd44780({
  pinRs: 18,
  pinEnable: 22,
  pinsData: [11, 12, 15, 16],
  lcdColums: 16
  lcdRows: 2
});

lcd.print('HD44780 Test!');

This script will show the date and time updated every second:

const hd44780 = require('gpio-hd44780-driver');

const lcd = hd44780({
  pinRs: 18,
  pinEnable: 22,
  pinsData: [11, 12, 15, 16],
  lcdColums: 16
  lcdRows: 2
});

setInterval(() => {
  lcd.setCursor(0, 0);

  const now = new Date();
  lcd.print(`${now.toDateString()}\n${now.toTimeString().slice(0,8)}`);
}, 1000);

Contributing

All contributions are welcome using pull requests on GitHub.