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 = ;const LCDScreen = ; // Initialize an LCD screen!const screen = // 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 defaultscreen; // screen.cursorBlink(bool)// If true, the cursor will blink// This is enabled by defaultscreen; // screen.cursorUnderscore(bool)// If true, an underscore will be shown at the cursor position// This is disabled by defaultscreen; // screen.clear()// Clears the screen and returns the cursor to the home positionscreenclear; // screen.cursorLeft()// Moves the cursor one space to the leftscreen; // screen.cursorLeft()// Moves the cursor one space to the rightscreen; // screen.cursorHome()// Moves the cursor to the beginning of the first linescreen; // screen.cursorSecondLine()// Moves the cursor to the beginning of the second linescreen; // screen.textLeft()// Moves the text on screen to the leftscreen; // screen.textRight()// Moves the text on screen to the rightscreen; // 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 textscreen; // 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 onescreen; // screen.writeText(stringOrBuffer)// Output some text on the screenscreen;// Output all your custom charactersscreen// Note that \n doesn't work here. Use screen.cursorSecondLine().// Please see the note at the beginning of the readme regarding the character set.