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

rpio-lcd

v0.0.4

Published

Control character LCDs with your Pi!

Downloads

9

Readme

rpio-lcd

Control character LCDs with your Pi using JavaScript!

This library has only been tested on 16x2 displays, but it should work for others.

A note on the LCD Character set:

The character set of the Hitachi HD44780UA00 (The most used character LCD screen controller) is mostly ascii but with some minor differences.

  • If you send it a backslash, ("\\") it will display a yen symbol (¥)
  • If you send it a tilde, ("~") it will display a left-arrow (←)
  • If you send it a DEL character, ("\x7f") it will display a right-arrow (→)

The characters beyond 0x7f include japanese katakana, some greek letters, and mathematical symbols. Check this out for more info!

const rpio = require("rpio");
const {LCDScreen} = require("rpio-lcd");

// Initialize an LCD screen!
const screen = new LCDScreen({
	// pins: [registerSelect, d4, d5, d6, d7]
	pins: [11, 13, 15, 16, 18],
	// This is optional, you can specify a ShiftRegister from "rpio-shift" here if the above pins are connected to one
	dataIO: null,

	// This is the enable pin on the LCD
	clockPin: 12,
	// This is optional, you can specify a ShiftRegister from "rpio-shift" here if the above pin is connected to one
	clockIO: null
})

// screen.displayOn(bool)
// If true, the display is shown. You can still write or send commands to the LCD while the screen is hidden
// This is enabled by default
screen.displayOn(true);

// screen.cursorBlink(bool)
// If true, the cursor will blink
// This is enabled by default
screen.cursorBlink(true);

// screen.cursorUnderscore(bool)
// If true, an underscore will be shown at the cursor position
// This is disabled by default
screen.cursorUnderscore(false);

// screen.clear()
// Clears the screen and returns the cursor to the home position
screen.clear();

// screen.cursorLeft()
// Moves the cursor one space to the left
screen.cursorLeft();

// screen.cursorLeft()
// Moves the cursor one space to the right
screen.cursorRight();

// screen.cursorHome()
// Moves the cursor to the beginning of the first line
screen.cursorHome();

// screen.cursorSecondLine()
// Moves the cursor to the beginning of the second line
screen.cursorSecondLine();

// screen.textLeft()
// Moves the text on screen to the left
screen.textLeft();

// screen.textRight()
// Moves the text on screen to the right
screen.textRight();

// screen.writeMode(goRight, moveScreen)
// If goRight is true, the cursor will move right when text is written, else, it'll go left.
// if moveScreen is true, the text will be moved opposite to the cursor position when text is written. useful for scrolling text
screen.writeMode(true, false);

// screen.setCustomChar(code, bufferOrArray)
// Allows you to specify a custom character. This is stored in the LCD's RAM so it will be lost when the LCD is powered off.
// You can store 8 custom characters with codes 0 to 7.
// For example, to display the following image:
/*
░███░
█░░░█
█░░░█
░███░
█░█░░
░██░█
░░██░
░░█░░
*/
// It is encoded as so, where 1 is a filled pixel and 0 is an unfilled one
screen.setCustomChar(0, [
    0b01110,
    0b10001,
    0b10001,
    0b01110,
    0b10100,
    0b01101,
    0b00110,
    0b00100
]);

// screen.writeText(stringOrBuffer)
// Output some text on the screen
screen.writeText("Hello, world!");
// Output all your custom characters
screen.writeText("\x00\x01\x02\x03\x04\x05\x06\x07")
// Note that \n doesn't work here. Use screen.cursorSecondLine().
// Please see the note at the beginning of the readme regarding the character set.