UNPKG

johnny-five-electron

Version:

Temporary fork to support Electron (to be deprecated)

50 lines (40 loc) 761 B
var five = require("../lib/johnny-five"); var board = new five.Board(); board.on("ready", function() { var heart = [ "01100110", "10011001", "10000001", "10000001", "01000010", "00100100", "00011000", "00000000" ]; var matrix = new five.Led.Matrix({ pins: { data: 2, clock: 3, cs: 4 } }); matrix.on(); var msg = "johnny-five-electron".split(""); // Display each letter for 1 second function next() { var c; if (c = msg.shift()) { matrix.draw(c); setTimeout(next, 1000); } } next(); this.repl.inject({ matrix: matrix, // Type "heart()" in the REPL to // display a heart! heart: function() { matrix.draw(heart); } }); });