noopkat/oled-js

Unable to utilise oled-js

Opened this issue · 1 comments

I'm unable to render text on the screen. For some reason, my code appears to not clear the screen properly and finish the rendering.

const five = require('johnny-five');

const board = new five.Board();

const Oled = require('oled-js');

const font = require('oled-font-5x7');

board.on('ready', function () {
  const opts = {
    width: 128,
    height: 64,
    address: 0x3C
  };

  const oled = new Oled(board, five, opts);
  oled.clearDisplay();
  oled.setCursor(1, 1);
  oled.writeString(font, 1, 'Cats and dogs are really cool animals, you know.', 1, true, 2, true);
  oled.update();
})

I used this code and confirmed the LCD works fine but when I run the StandardFirmataPlus on the board and execute the above JS code this is what I end up with – the Hello World doesn't seem to get cleared and the text seems cut off as if the screen dimensions are smaller than 128x64.

image

Can someone say what I'm doing wrong?

Use: oled.update() right after the oled.clearDisplay() command.