mad_science.js

You want to do WHAT?! with JavaScript

Hi I´am Sebastian

  • company: denkwerk
  • origin: cologne/germany
  • skill: average js dev from next door
  • internetz: @asciidisco
  • love: coffee
  • love: 80´s movies
  • love: multi colored socks

A bit of history

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

<3 robots!

Arduino is your key to the robot world behind the scientists doors

Meet THE ARDUINO

A MICROCONTROLLER FOR EVERYONE

Arduino

  • A tool for making computers control & sense more of the physical world
  • Arduino projects can be stand-alone
  • Or they can be communicate with software running on your computer
  • Inexpensive - starts around 25 Euro
  • Cross-platform - works on *nix & Win
  • Open source - even the hardware layout
  • 3rd Party Extensions - displays, network adapters, 3G adapters...

Cool dude, but we are at a JavaScript Conference...

A bit of history

Node serialport

  • Born Sep 07, 2010
  • Bidiricetional communication via the USB Port over the SP protocol
  • Node.js was able to connect to real world!
  • Arduino can be controlled via the SP protocol. Hmmm......

Johnny-five

  • Connect to arduino from node
  • Super slick api
  • board = new five.Board();
  • led = new five.Led({pin: 13});
  • led.on();
  • Thx @rwaldron (and all the contributors)

Isn´t that difficult, you know hardware & things?!

No!

DEMO TIME

Leds (Scheme)

Leds (Code)

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

});

Sensors (Scheme)

Sensors (Code)

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

All you need is JS

Why?!

Thank you