Created by Asoul @ WisdomGarden 2015.10.22
Arduino is an open-source electronics platform based on easy-to-use hardware and software.
npm install johnny-five
var five = require("johnny-five")
var board = new five.Board()
board.on("ready", function() {
var led = new five.Led(13)
led.blink(500)
})
var brightness = 0
function controller(ch, key) {
if (key) {
if (key.name === "up") {
brightness += 25
}
if (key.name === "down") {
brightness -= 25
}
brightness = Math.max(brightness, 0)
brightness = Math.min(brightness, 250)
led.brightness(brightness)
}
}
process.stdin.on("keypress", controller)
var piezo = new five.Piezo(3)
piezo.play({
song: "C D F D A - A A A A G G G G - - C D F D G - G G G G F F F F - -",
beats: 1 / 4,
tempo: 100
})