@tootallnate/oled
Render to OLED displays over the I2C bus
This module provides implementations for rendering to OLED displays using a consitent interface. A terminal emulator is also included to make local usage easier.
Individual pixels are accessed using a two-dimensional [x][y]
array syntax, where a value of
0 means the pixel is off, and 1 means the pixel is on.
SSD1305
Adafruit 2.23" Monochrome OLED Bonnet for Raspberry Pi
import * as i2c from 'i2c-bus';
import { OledSSD1305 } from '@tootallnate/oled';
const bus = i2c.openSync(1);
const oled = new OledSSD1305({
bus,
address: 0x3c,
width: 128,
height: 32
});
oled[0][0] = 1;
oled[0][1] = 1;
oled.render();
SSD1306
Adafruit PiOLED - 128x32 Monochrome OLED Add-on for Raspberry Pi
import * as i2c from 'i2c-bus';
import { OledSSD1306 } from '@tootallnate/oled';
const bus = i2c.openSync(1);
const oled = new OledSSD1306({
bus,
address: 0x3c,
width: 128,
height: 32
});
oled[0][0] = 1;
oled[0][1] = 1;
oled.render();
TTY (Terminal Emulator)
import { OledTTY } from '@tootallnate/oled';
const oled = new OledTTY({
width: 128,
height: 32
});
oled[0][0] = 1;
oled[0][1] = 1;
oled.render();
▄ ▄ ▄▄ ▄▄ ▄▄ ▄ ▄
█ █ ▄▄▄ █ █ ▄▄▄ ▄ ▄ ▄▄▄ ▄ ▄▄ █ ▄▄ █ █
█▀▀▀█ █▄▄▄█ █ █ █ █ █ ▄ █ █ █ █▀ ▀ █ █ ▀█ █
█ █ ▀▄▄▄ ▄█▄ ▄█▄ ▀▄▄▄▀ ▀▄▀▄▀ ▀▄▄▄▀ █ ▄█▄ ▀▄▄▄█ ▄