ssd1306-i2c-js
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.5 • Public • Published

    ssd1306-i2c-js

    Support Node of LTS npm version Build passing Build passing Support dependencies nan License mit tested


    Description

    Module ssd1306-i2c-js is a simple javascript wrapper of vadzimyatskevich/SSD1306. No logic added, just existing methods wrapped.

    How to use

    Import in node js

    Install library, simple run:

    npm install --save ssd1306-i2c-js

    Use in your project

    Typescript

    import {display, Font, Color, Layer } from 'ssd1306-i2c-js'

    Javascript

    var ssd1306 = require('ssd1306-i2c-js');
    var display = ssd1306.display;
    var Font = ssd1306.Font;
    var Color = ssd1306.Color;
    var Layer = ssd1306.Layer;

    Configure and setup your display using init(i2cNumber, address) method.

    Parameter i2cNumber is the mini-pc i2c bus name in /dev/ in with is connected display.
    Parameter address is the i2c address of display driver ad specified in datasheet.

    display.init(1, 0x3C);      // Open bus and initialize driver
    display.turnOn();           // Turn on display module
    display.clearScreen();      // Clear display buffer
    display.refresh();          // Write buffer in display registries

    Setup font

    display.setFont(Font.UbuntuMono_8ptFontInfo);

    Available fonts are defined in Font enum.

    Drawing functions
    Following function are available.

    display.drawPixel(x, y, color, layer);
    display.drawLine(x, y, x1, y1, color, layer);
    display.drawRect(x, y, w, h, color, layer);
    display.fillRect(x, y, w, h, color, layer);
    display.drawString(x:number, y:number, text, size, color, layer);

    Refresh function
    Use the refresh method to update the display.

    display.refresh();

    Dispose i2c bus
    To close i2c bus call dispose function.

    process.on('SIGINT', function(){
        display.dispose();
        process.exit();
    });

    Install

    npm i ssd1306-i2c-js

    DownloadsWeekly Downloads

    2

    Version

    1.0.5

    License

    MIT

    Unpacked Size

    341 kB

    Total Files

    40

    Last publish

    Collaborators

    • riolo.giuseppe