Created
October 2, 2012 23:06
-
-
Save rwaldron/3823876 to your computer and use it in GitHub Desktop.
LCD Animated Runner w/ Johnny-Five https://github.com/rwldrn/johnny-five
This file contains hidden or 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
var five = require("../lib/johnny-five"); | |
(new five.Board()).on("ready", function() { | |
var lcd = new five.LCD({ | |
// LCD pin name RS EN DB4 DB5 DB6 DB7 | |
// Arduino pin # 7 8 9 10 11 12 | |
pins: [ 7, 8, 9, 10, 11, 12 ], | |
rows: 2, | |
cols: 16 | |
}); | |
lcd.on("ready", function() { | |
var frame = 1, col = 0, row = 0; | |
// Running A & B are stored in the built-in character library! | |
lcd.useChar("runninga"); | |
lcd.useChar("runningb"); | |
board.loop( 300, function() { | |
lcd.clear().setCursor( col, row ).print( | |
":running" + (++frame % 2 === 0 ? "a" : "b") + ":" | |
); | |
if ( ++col === lcd.cols ) { | |
col = 0; | |
if ( ++row === lcd.rows ) { | |
row = 0; | |
} | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment