On Github jweakley / triconf2014Talk
Feeding Backyard Tilapia from the Command Line
Other Than Taking Over the World
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(13);
// "strobe" the led in 100ms on-off phases
led.strobe(100);
});
five.board().on("ready", function() {
var piezo = new five.Piezo(3);
piezo.play({
song: [
["C4", 1],
["D4", 1],
["E4", 1],
["F4", 1],
["G4", 1],
["A4", 1],
["B4", 1],
["C5", 1]
],
tempo: 200
});
});
var five = require('johnny-five');
var songs = require('j5-songs');
five.Board().on('ready', function () {
var piezo = new five.Piezo(3);
// Load a song object
var song = songs.load('mario-fanfare');
// Play it !
piezo.play(song);
});
var five = require("johnny-five"),
board, servo;
board = new five.Board();
board.on("ready", function() {
// Create a new `servo` hardware instance.
servo = new five.Servo({
pin: 9,
range: [0,160]
});
// "sweep" the servo from min to max
servo.sweep();
});
board.on("ready", function() {
range = [0,159];
photoresistor = new five.Sensor({ pin: "A0", freq: 50 });
servo = new five.Servo({ pin: 9, range: range });
// "data" get the current reading from the photoresistor
photoresistor.scale(range).on("data", function() {
servo.to(Math.floor(this.scaled));
});
});