Skip to content

Instantly share code, notes, and snippets.

@Pofay
Last active October 18, 2018 08:40
Show Gist options
  • Save Pofay/e2fb9c21da4fbfee5fdddc983b1bc104 to your computer and use it in GitHub Desktop.
Save Pofay/e2fb9c21da4fbfee5fdddc983b1bc104 to your computer and use it in GitHub Desktop.
const Lcd = require('lcd');
const moment = require('moment')
const lcd = new Lcd({ rs: 25, e: 24, data: [23, 17, 21, 22], cols: 16, rows: 2})
lcd.on('ready', () => {
setInterval(() => {
lcd.setCursor(0, 0);
lcd.print(moment().format('h:mm:ss a'), (err) => {
if (err) {
throw err;
}
lcd.setCursor(0,1);
lcd.print('Hello There!', (err) => {
if(err) throw err;
});
});
}, 1000);
});
process.on('SIGINT', () => {
lcd.close();
process.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment