Making Robots! – Joe Weakley – @josephweakley



Making Robots! – Joe Weakley – @josephweakley

0 0


triconf2014Talk


On Github jweakley / triconf2014Talk

Making Robots!

Joe Weakley

@josephweakley

github.com/jweakley

Feeding Backyard Tilapia from the Command Line

Why Make Robots?

Other Than Taking Over the World

  • Free You Up From Boring/Repeditive Tasks
  • Make Something That Dosn't Exist
  • Because It's Fun
  • Why Not?

GPIO Pin!

General-Purpose Input/Output

Hardware Platforms

  • Beaglebone
  • Raspberry Pi
  • Arduino

Wonderful Software Libraries

Javascript

Ruby

Go

Hello World?

LED!

							
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);
});

							
						

Making Music

Piezo!

							
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
  });
});
							
						

j5-songs

							
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);
});
							
						

Interacting with the Real World

Servo!

							
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();
});

							
						

Inputs

Photoresistor

							
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));
  });
});
							
						

Remotly Feeding Fish?!?!?

Devices

Go Forth and Take Over The World!