Skip to content

Commit

Permalink
LED: Add draw examples for 8x8 Matrix, add LED characters file.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorydotcom committed Jul 8, 2015
1 parent f13f78f commit 061d145
Show file tree
Hide file tree
Showing 5 changed files with 444 additions and 197 deletions.
24 changes: 24 additions & 0 deletions eg/led-chars-demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var five = require("../lib/johnny-five");

var board = new five.Board();

board.on("ready", function() {

var matrix = new five.Led.Matrix({
pins: {
data: 2,
clock: 3,
cs: 4
}
});

matrix.on();

// type `draw("shape_name")` into the repl to see the shape!
this.repl.inject({
matrix: matrix,
draw: function(shape) {
matrix.draw(five.Led.Matrix.CHARS[shape]);
}
});
});
35 changes: 35 additions & 0 deletions eg/led-enumeratechars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
var five = require("../lib/johnny-five");

var board = new five.Board();

board.on("ready", function() {

var matrix = new five.Led.Matrix({
pins: {
data: 2,
clock: 3,
cs: 4
}
});

matrix.on();

var shapes = Object.keys(five.Led.Matrix.CHARS);

var enumerate = function() {
var i = 0;
board.loop(500, function() {
if (i < shapes.length) {
matrix.draw(five.Led.Matrix.CHARS[shapes[i]]);
i++;
}
});
};

enumerate();

this.repl.inject({
matrix: matrix,
enumerate: enumerate
});
});
Loading

0 comments on commit 061d145

Please sign in to comment.