add LCD time counter

This commit is contained in:
2013-12-30 23:20:36 +08:00
parent 114f6ee9ca
commit 25a6ff8be4
3 changed files with 24 additions and 8 deletions
+6 -8
View File
@@ -3,19 +3,17 @@ board = new five.Board()
board.on 'ready', ()->
lcd = new five.LCD {
#I don't know why it doesn't work when I use 1, 2, 3, 4 as DB4, DB5, DB6 ,DB7
#LCD pin name RS EN DB4 DB5 DB6 DB7
#I don't know why it doesn't work when I use 1, 2, 3, 4 as DB4, DB5, DB6 ,DB7
#LCD pin name RS EN DB4 DB5 DB6 DB7
pins: [10, 11, 4, 5, 6, 7]
}
lcd.on 'ready', ()->
lcd.useChar("check");
lcd.useChar("heart");
lcd.useChar("duck");
lcd.useChar("heart")
lcd.clear().print("Junv:");
lcd.cursor(1, 0);
lcd.clear().print("Junv:")
lcd.cursor(1, 0)
lcd.print("I :heart: Johnny-five");
lcd.print("I :heart: Johnny-five")
return
+18
View File
@@ -0,0 +1,18 @@
five = require 'johnny-five'
board = new five.Board()
board.on 'ready', ()->
lcd = new five.LCD {
pins: [10, 11, 4, 5, 6, 7]
}
initTime = new Date()
lcd.on 'ready', ()->
setInterval ()->
lcd.clear()
lcd.print 'Current time is:'
lcd.cursor(1, 0)
time = new Date() - initTime
lcd.print "#{time}"
return
, 500
return
Binary file not shown.

After

Width:  |  Height:  |  Size: 755 KiB