Slide 1

Slide 1 text

Javascript in the real world

Slide 2

Slide 2 text

Andrew Nesbitt @teabass github.com/andrew

Slide 3

Slide 3 text

Bertie @BertramRabbit Mr April 2014

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Any application that can be written in JavaScript, will eventually be written in JavaScript

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

patrick-wied.at/static/nudejs/

Slide 9

Slide 9 text

patrick-wied.at/static/nudejs/

Slide 10

Slide 10 text

bellard.org/jslinux/

Slide 11

Slide 11 text

reddit.com/r/atwoodslaw

Slide 12

Slide 12 text

Buildcat Alex Potsides

Slide 13

Slide 13 text

github.com/achingbrain/build-cat

Slide 14

Slide 14 text

Hardware hacking with Javascript

Slide 15

Slide 15 text

Why JAvascript?

Slide 16

Slide 16 text

Higher Level

Slide 17

Slide 17 text

Async

Slide 18

Slide 18 text

Lower Barriers

Slide 19

Slide 19 text

Javascript is popular 871,108 JS repos on github

Slide 20

Slide 20 text

Internet of things

Slide 21

Slide 21 text

Hardware

Slide 22

Slide 22 text

Arduino

Slide 23

Slide 23 text

Johnny-five github.com/rwaldron/johnny-five

Slide 24

Slide 24 text

Firmata

Slide 25

Slide 25 text

var five = require("johnny-five"); var board = new five.Board(); board.on("ready", function() { led = new five.Led({ pin: 9 }); board.repl.inject({ led: led }); led.pulse(500); this.wait( 10000, function() { led.stop().off(); }); });

Slide 26

Slide 26 text

Kinect Controlled Arm

Slide 27

Slide 27 text

Biped Nodebot

Slide 28

Slide 28 text

Cat Laser Toy

Slide 29

Slide 29 text

Rabbit Laser Toy

Slide 30

Slide 30 text

var five = require("johnny-five"), board = new five.Board(); function randomFromInterval(from,to){ return Math.floor(Math.random()*(to-from+1)+from); } board.on("ready", function() { var servoX = new five.Servo(10); var servoY = new five.Servo(9); var laser = new five.Led(8); laser.on() setInterval(function(){ x = randomFromInterval(80, 120) y = randomFromInterval(95, 145) servoX.move(x) servoY.move(y) }, 400) })

Slide 31

Slide 31 text

DEMO

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

github.com/rwaldron/johnny-five

Slide 34

Slide 34 text

Sparkfun Inventors Kit hobbytronics.co.uk/sparkfun-inventors-kit-v3

Slide 35

Slide 35 text

node-ardx.org

Slide 36

Slide 36 text

LEGO

Slide 37

Slide 37 text

EV3

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

var Ev3 = require ("ev3-nodejs-bt"); var Ev3_base = Ev3.base; var XboxController = require('xbox-controller'); var xbox = new XboxController; var robot = new Ev3_base("/dev/tty.EV3-SerialPort"); var maxAngle = 32768; var maxSpeed = 100; var speeds = { a: 0, b: 0, c: 0, d: 0 };

Slide 40

Slide 40 text

robot.connect(function(){ robot.start_program(function(ev3){ var setSpeed = function(){ var output = ev3.getOutputSequence(speeds.a,speeds.b,speeds.c,speeds.d); ev3.sp.write(output); } setInterval(setSpeed, 100) xbox.on('left:move', function(position){ var x = -(position.x / maxAngle)*-maxSpeed var y = (position.y / maxAngle)*-maxSpeed var left = y-x var right = y+x speeds.b = left speeds.a = right }) xbox.on('a:press', function(){ speeds.d = 100 }) xbox.on('a:release', function(){ speeds.d = 0 }) }); });

Slide 41

Slide 41 text

DEMO

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

github.com/andrew/node-ev3-robot

Slide 45

Slide 45 text

github.com/clebert/ev3

Slide 46

Slide 46 text

Linux running on lego

Slide 47

Slide 47 text

Nodecopter

Slide 48

Slide 48 text

Programmatic Flying Robots

Slide 49

Slide 49 text

HD Camera Downfacing camera Gyroscope Wifi 1GHz CPU Linux Accelerometer Magnetometer Ultrasound

Slide 50

Slide 50 text

github.com/felixge/node-ar-drone

Slide 51

Slide 51 text

var arDrone = require('ar-drone'); var client = arDrone.createClient(); client.takeoff(); client .after(5000, function() { this.clockwise(0.5); }) .after(3000, function() { this.animate('flipLeft', 15); }) .after(1000, function() { this.stop(); this.land(); });

Slide 52

Slide 52 text

QR CodeR

Slide 53

Slide 53 text

Dance Dance Drone

Slide 54

Slide 54 text

DEMO

Slide 55

Slide 55 text

WARNING

Slide 56

Slide 56 text

github.com/eschnou/ardrone-webflight

Slide 57

Slide 57 text

Quadcopters as a Service

Slide 58

Slide 58 text

robot laser pong

Slide 59

Slide 59 text

JavaSCript Microcontrollers

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

Arduino Yun

Slide 64

Slide 64 text

£70 £21 £30 £55 Lua based Tiny-js Node.js or browser Node.js plug and play Hacker friendly Tiny computer Arduino++

Slide 65

Slide 65 text

JavaSCript Hardware in the browser

Slide 66

Slide 66 text

In Development Vibration api Ambient light sensor Proximity sensor TCP Socket API wiki.mozilla.org/WebAPI

Slide 67

Slide 67 text

Future? UDP Datagram Socket API WebNFC WebUSB WebBluetooth wiki.mozilla.org/WebAPI

Slide 68

Slide 68 text

whatwg.github.io/serial

Slide 69

Slide 69 text

Go forth and make robots

Slide 70

Slide 70 text

No animals were harmed in the making of this presentation Thanks!

Slide 71

Slide 71 text

Bonus Content

Slide 72

Slide 72 text

Kinect Drone

Slide 73

Slide 73 text

NoDebots.io

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

Makey Makey

Slide 77

Slide 77 text

Rabbit Photo Booth

Slide 78

Slide 78 text

var video = document.getElementById("v"), canvas = document.getElementById("c"), div = document.getElementById('images'); navigator.mozGetUserMedia({video: true}, function(stream) { video.src = window.URL.createObjectURL(stream); video.play() }); takePhoto = function(){ canvas.getContext("2d").drawImage(video, 0, 0, 300, 300); var img = canvas.toDataURL("image/png"); var image = new Image(); image.width = 320 image.height = 240 div.appendChild(image); image.src = img; } window.onkeypress = function(k){ if(k.charCode === 103){ takePhoto() } }

Slide 79

Slide 79 text

No content