Node Library for using adafruit i2c rgb lcd pi plate
Node.js implementation for the Adafruit RGB 16x2 LCD+Keypad Kit for Raspberry Pi http://www.adafruit.com/products/1110
Note: Since version 1.0.0 this module is based on i2c-bus. For compatibility with your node.js version read the i2c-bus documentation. Older versions of this module were based on i2c. adafruit-i2c-lcd version 0.1.x only works with node.js 0.12.x and adafruit-i2c-lcd version 0.0.x only works with node.js 0.10.x.
Note: This module is compatible with Sainsmart 1602 I2C, see Compatibility
npm install adafruit-i2c-lcd --save
var LCDPLATE lcd;LCDPLATE = require'adafruit-i2c-lcd'plate;lcd = 1 0x20;lcdbacklightlcdcolorsRED;lcdmessage'Hello World!';lcdon'button_change'lcdclear;lcdmessage'Button changed:\n' + lcdbuttonNamebutton;;
Setting up a new LCDPLATE.
Clear the LCD, remove all text.
Close the LCD plate. Use this to stop the polling.
Set the backlight of the LCD to the given color. You can use predefined colors from the LCDPLATE class:
LCDPLATE.colors = [OFF, RED, GREEN, BLUE, YELLOW, TEAL, VIOLET, WHITE, ON]
Add the text on the LCD. Use \n as line feed. Only the first two lines will be sent to the display. If parameter clear is given and true only the text is shown, previous content on the lcd will be cleared.
Defines custom characters. Index must be between 0 and 7. Pattern is the pattern of your character, must contain exactly 8 bytes. E.g. you can easyly design your custom character at http://www.quinapalus.com/hd44780udg.html to show your custom character use eg. lcd.message('\x01').
lcdcreateChar1 001031311440;lcdcreateChar2 041017171040;lcdclear;lcdbacklightlcdcolorsRED;lcdmessage'I\x01 n\x02de.js' true;
Returns the pressed buttons as a number. Use bitmasks to mask out the state of the desired button. See LCDPLATE.buttons for button values.
Returns the name, e.g. 'SELECT' to a button number. See LCDPLATE.buttons for button values.
Fires if a button is pressed or released.
lcdon'button_change'lcdclear;lcdmessage'Button changed:\n' + lcdbuttonNamebutton;;
Fires if a button is released.
Fires if a button is pressed.
This library is compatible with the Sainsmart 1602 I2C (SKU: 20-011-221) with some notable exceptions. This clone has a blue backlight and an RGB LED on-board.
lcdsendBytes0 0x1F; // Sainsmart 1602 I2C backlight onlcdsendBytes0 0x3F; // Sainsmart 1602 I2C backlight off
Based on the Adafruit's Raspberry-Pi Python Code Library
Here is a growing collection of libraries and example python scripts for controlling a variety of Adafruit electronics with a Raspberry Pi
Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!
Written by Limor Fried, Kevin Townsend and Mikey Sklar for Adafruit Industries. BSD license, all text above must be included in any redistribution
To download, we suggest logging into your Pi with Internet accessibility and typing: git clone https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git