@_JuraseC @NodeBotsMX
* http://es.wikipedia.org/wiki/Actuador
var five = require("johnny-five"),
button, led;
five.Board().on("ready", function() {
button = new five.Button({
pin: 2,
isPullup: true
});
led = new five.Led(9);
button.on("down", function(value) {
console.log("down");
});
button.on("up", function() {
console.log("up");
});
});
var five = require("johnny-five");
new five.Board().on("ready", function() {
var motion = new five.Pir(8);
console.log(">>> Ready.");
motion.on("motionstart", function() {
console.log( "Something moved!" );
});
motion.on("motionend", function() {
console.log( "All quiet now..." );
});
motion.on("calibrated", function() {
console.log( "calibrated ready..." );
});
motion.on("data", function(err, value) {
// console.log("data", value);
});
});
var five = require("johnny-five");
five.Board().on("ready", function() {
var flameSensor = new five.Sensor({
pin: "A0",
freq: 300
});
flameSensor.scale([0,100]).on("data", function() {
console.log(">> " + (this.value - 8) );
});
});
var five = require("johnny-five"),
keypress = require("keypress");
five.Board().on("ready", function() {
var led = new five.Led.RGB({
pins: {
red: 3,
green: 5,
blue: 6
}
});
// Turn it on and set the initial color
led.on();
led.color("#FF0000");
// Listen for user input to change the RGB color
process.stdin.resume();
process.stdin.setEncoding("utf8");
process.stdin.setRawMode(true);
var keymap = {
r: "#FF0000", // red
g: "#00FF00", // green
b: "#0000FF", // blue
w: "#FFFFFF" // white
};
process.stdin.on("keypress", function(ch, key) {
if (!key) return;
if (keymap[key.name]) {
led.color(keymap[key.name]);
} else {
led.off();
}
});
});
Led RGB
var five = require("johnny-five"),
board, servo;
board = new five.Board();
board.on("ready", function() {
// Create a new `servo` hardware instance.
servo1 = new five.Servo(13);
board.repl.inject({
servo1: servo1
});
servo1.center();
});
Comentarios, sugerencias: @_JuraseC
No olvides registrate en nuestra comunidad de JavaScript: http://javascriptmx.com/