https://github.com/thatisuday/dot-matrix-lcd
A simple Dot Matrix LCD emulator for JavaScript
https://github.com/thatisuday/dot-matrix-lcd
dot-matrix dot-matrix-lcd dot-matrix-led javascript plugin
Last synced: about 1 year ago
JSON representation
A simple Dot Matrix LCD emulator for JavaScript
- Host: GitHub
- URL: https://github.com/thatisuday/dot-matrix-lcd
- Owner: thatisuday
- Created: 2019-12-09T18:59:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T02:40:18.000Z (over 3 years ago)
- Last Synced: 2025-04-02T01:42:12.153Z (about 1 year ago)
- Topics: dot-matrix, dot-matrix-lcd, dot-matrix-led, javascript, plugin
- Language: JavaScript
- Size: 2.94 MB
- Stars: 17
- Watchers: 1
- Forks: 3
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dot-matrix-lcd
A JavaScript plugin to emulate Dot Matrix LCD display.

# Install
```bash
npm i -S dot-matrix-lcd
```
# Import in HTML
```html
```
> This script exposes `LCD` class on `window` object.
# Import in Node.js
```js
const LCD = require('dot-matrix-lcd');
```
## Plugin API
```js
var lcd = new LCD({
elem: document.getElementById("lcd-container"),
rows: 2, // number of character rows on the LCD screen
columns: 16, // number of character columns on the LCD screen
pixelSize: 4, // size of each pixel
pixelColor: "#000", // color of the pixel
});
// Write a character on LCD screen.
// charCode => decimal number or hexadecimal string ASCII code point
// blockIndex => index of the character block (default: 0)
lcd.writeCharacter( { charCode, blockIndex } );
// Write string (text) on LCD screen.
// string => text (default: "")
// offset => offset index from the start of the screen.
lcd.writeString({ string, offset });
// Clear a character at a given index on the LCD screen.
// blockIndex => Index of the character block (default: 0)
lcd.clearCharacter({ blockIndex });
// Toggle cursor blink at the given character block.
// blockIndex => index of the character block (default: 0)
// stop => stop cursor blink (default: false)
lcd.blinkCursor({ blockIndex, stop });
// Clear entire LCD screen.
lcd.clearScreen();
```