Skip to content

Instantly share code, notes, and snippets.

@mokjpn
Created October 22, 2019 12:50
Show Gist options
  • Save mokjpn/ec7055a39ef28c06abe0695eed9fcda4 to your computer and use it in GitHub Desktop.
Save mokjpn/ec7055a39ef28c06abe0695eed9fcda4 to your computer and use it in GitHub Desktop.
LCD test for M5StickC with ObnizOS
const m5 = require('m5stickcjs');
var obniz = new m5("XXXXXXXX");
obniz.onconnect = async function () {
// lcd = obniz.wired('ST7735S', { mosi: 15, sclk: 13, dc: 23, res:18, cs:5});
lcd = obniz.m5display;
await lcd.onWait();
console.log(lcd.width); //128
console.log(lcd.height); //160
lcd.setRotation(1);
lcd.fillScreen(lcd.color16(0,200,0));
lcd.fillRect(0, 0, lcd.width/2, lcd.height/2, lcd.color16(200,20,155));
lcd.drawString(0, lcd.height / 2, "M5Stick", 0, 0, 2);
lcd.drawString(0, lcd.height / 2+14, "obniz", 0, 0, 2);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment