-
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.
- Loading branch information
Showing
9 changed files
with
67 additions
and
170 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
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
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
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
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
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
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 |
---|---|---|
@@ -1,34 +1,40 @@ | ||
var temporal = require("temporal"); | ||
var five = require("../lib/johnny-five.js"); | ||
var board = new five.Board(); | ||
|
||
board.on("ready", function() { | ||
|
||
// Initialize the RGB LED | ||
var led = new five.Led.RGB([6,5,3]); | ||
var led = new five.Led.RGB([6, 5, 3]); | ||
|
||
// Set to full intensity red | ||
console.log("100% red"); | ||
led.color("#FF0000"); | ||
|
||
|
||
// After 3 seconds, dim to 30% intensity | ||
setTimeout(function() { | ||
console.log("30% red"); | ||
led.intensity(30); | ||
|
||
// 3 secs then turn blue, still 30% intensity | ||
setTimeout(function() { | ||
console.log("30% blue"); | ||
led.color("#0000FF"); | ||
|
||
temporal.queue([ | ||
{ | ||
// After 3 seconds, dim to 30% intensity | ||
wait: 3000, | ||
task: function() { | ||
console.log("30% red"); | ||
led.intensity(30); | ||
} | ||
}, | ||
{ | ||
// 3 secs then turn blue, still 30% intensity | ||
wait: 3000, | ||
task: function() { | ||
console.log("30% red"); | ||
led.intensity(30); | ||
This comment has been minimized.
Sorry, something went wrong.
derekwheee
Collaborator
|
||
} | ||
}, | ||
{ | ||
// Another 3 seconds, go full intensity blue | ||
setTimeout(function() { | ||
wait: 3000, | ||
task: function() { | ||
console.log("100% blue"); | ||
led.intensity(100); | ||
}, 3000); | ||
|
||
}, 3000); | ||
|
||
}, 3000); | ||
|
||
}); | ||
} | ||
}, | ||
]); | ||
}); |
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
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
Ok, good. I started to do this in the first place but wasn't sure which was more obvious for a simple example.