Last active
October 18, 2018 09:45
-
-
Save Pofay/755a18f01121d568758f29d3eaffee1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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