-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LED: Add draw examples for 8x8 Matrix, add LED characters file.
- Loading branch information
jorydotcom
committed
Jul 8, 2015
1 parent
f13f78f
commit 061d145
Showing
5 changed files
with
444 additions
and
197 deletions.
There are no files selected for viewing
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
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]); | ||
} | ||
}); | ||
}); |
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
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 | ||
}); | ||
}); |
Oops, something went wrong.