Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Where does the javascript run, anyway?

C J Silverio
November 15, 2013

Where does the javascript run, anyway?

A beginner's guide to hardware with Javascript.

C J Silverio

November 15, 2013
Tweet

More Decks by C J Silverio

Other Decks in Programming

Transcript

  1. Hardware input & output What the Arduino & the Pi

    have in common: inputs and outputs.
  2. Connect to the physical world. Turn lights on & off.

    Run motors. Fire missiles at nodecopters. !
  3. The super power of a microcontroller is the GPIO. The

    GPIO connects variables in software to physical objects: the power level on a wire is information.
  4. Breadboard 101 The + and – columns are connected. The

    rows are connected. Board +/5V ➜ + Board ground ➜ –
  5. Lighting an LED is simple. Power to breadboard resistor from

    + to long wire on the LED LED short wire to breadboard – – to board GND
  6. Async Goodness with Buttons ! var five = require('johnny-five'); var

    board = new five.Board(); ! board.on('ready', function() { // signal goes into arduino pin 8 var button = new five.Button(8); ! button.on('down', function() { console.log('down'); }); button.on('up', function() { console.log('up'); }); button.on('hold', function() { console.log('holding'); }); });
  7. Tethered. :( You need to stay connected to a host

    capable of running Node.js, which the Arduino is not.
  8. Decisions, decisions. Arduino tiny Arduinos Raspberry Pi Beagle cheap cheaper

    CPU! more CPU! 14 pins size varies 8 pins 65 pins lots of modules features vary great video more memory C++ js tethered C++ any language any language prototyping mobile projects general use, audio-vis CPU-intensive lots of connections
  9. Play! Putter around. Buy two of everything because you will

    melt things sometimes. It’ll be okay.