Skip to content

Instantly share code, notes, and snippets.

@Pofay
Last active October 18, 2018 09:45
Show Gist options
  • Save Pofay/755a18f01121d568758f29d3eaffee1b to your computer and use it in GitHub Desktop.
Save Pofay/755a18f01121d568758f29d3eaffee1b 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}) // These pin numbers must reflect the schematic.
lcd.on('ready', () => {
setInterval(() => {
lcd.setCursor(0, 0);
lcd.print(moment().format('h:mm:ss a'), (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