back then when i was a kid i always wanted to be a mad scientist with big glasses and a laboratory coat, working in a laboratory and...
... then i discovered javascript
A MICROCONTROLLER FOR EVERYONE
board = new five.Board();
led = new five.Led({pin: 13});
led.on();
var five = require("johnny-five"),
board, led;
board = new five.Board();
board.on("ready", function() {
// Create a standard `led` hardware instance
led = new five.Led({
pin: 13
});
// "on" turns the led _on_
led.on();
});
var five = require("johnny-five"),
board, photoresistor;
board = new five.Board();
board.on("ready", function() {
// Create a new `photoresistor` hardware instance.
photoresistor = new five.Sensor({
pin: "A2",
freq: 250
});
// "read" get the current reading from the photoresistor
photoresistor.on("change", function(err, value) {
console.log(value); // or io.sockets.emit('pr', value);
});
});