Giter Site home page Giter Site logo

dot-matrix-lcd's Introduction

dot-matrix-lcd

A JavaScript plugin to emulate Dot Matrix LCD display.

Install

npm i -S dot-matrix-lcd

Import in HTML

<!-- LCD Display Container -->
<div id="lcd-container" class="lcd-container"></div>

<!-- Plugin Script -->
<script src="./dist/index.js"></script>

This script exposes LCD class on window object.

Import in Node.js

const LCD = require('dot-matrix-lcd');

Plugin API

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();

dot-matrix-lcd's People

Contributors

dependabot[bot] avatar thatisuday avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

dot-matrix-lcd's Issues

blinkCursor does not turn off

The blinkCursor function does not seem to work correctly. I can start the cursor blinking with:
lcd.blinkCursor({
blockIndex: 10,
stop: false
});

Which works fine, but if i try to turn the blink off with:
lcd.blinkCursor({
blockIndex: 10,
stop: true
});

it continues to blink

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.