Slide 1

Slide 1 text

jQuery UK 16 May 2014 1 / 73

Slide 2

Slide 2 text

Andrew Nesbitt Bath, UK @teabass GitHub 2 / 73

Slide 3

Slide 3 text

Francis Gulotta New York City, USA @reconbot Wizard Development 3 / 73

Slide 4

Slide 4 text

Hardware Hacking with JavaScript 4 / 73

Slide 5

Slide 5 text

Hardware Hacking? 5 / 73

Slide 6

Slide 6 text

Hardware Hacking? Combining electronics and physical components with code 6 / 73

Slide 7

Slide 7 text

Hardware Hacking? Combining electronics and physical components with code Making real things and controlling them with software 7 / 73

Slide 8

Slide 8 text

Hardware Hacking? Combining electronics and physical components with code Making real things and controlling them with software Building things with your hands 8 / 73

Slide 9

Slide 9 text

Hardware Hacking? Combining electronics and physical components with code Making real things and controlling them with software Building things with your hands Joining the Maker Movement 9 / 73

Slide 10

Slide 10 text

Why JavaScript? 10 / 73

Slide 11

Slide 11 text

Why JavaScript? Hardware demands asynchronous software 11 / 73

Slide 12

Slide 12 text

Why JavaScript? Hardware demands asynchronous software Huge and diverse community 12 / 73

Slide 13

Slide 13 text

Why JavaScript? Hardware demands asynchronous software Huge and diverse community Lowering the barriers to entry 13 / 73

Slide 14

Slide 14 text

Why yes, JavaScript! Hardware demands asynchronous software Huge and diverse community Lowering the barriers to entry JavaScript is the language of the web 14 / 73

Slide 15

Slide 15 text

Internet of Things 15 / 73

Slide 16

Slide 16 text

Internet of Things Bridging hardware devices and online services 16 / 73

Slide 17

Slide 17 text

Internet of Things Bridging hardware devices and online services Treating hardware as an API 17 / 73

Slide 18

Slide 18 text

Internet of Things Bridging hardware devices and online services Treating hardware as an API Interconnecting all kinds of hardware 18 / 73

Slide 19

Slide 19 text

Internet of Things Bridging hardware devices and online services Treating hardware as an API Interconnecting all kinds of hardware Mashing up software and hardware 19 / 73

Slide 20

Slide 20 text

Demo Driven Development 20 / 73

Slide 21

Slide 21 text

21 / 73

Slide 22

Slide 22 text

Makey Makey 22 / 73

Slide 23

Slide 23 text

Makey Makey keys = { 87: 'W', 65: 'A', 83: 'S', 68: 'D' } $(document).keydown(function (e) { console.log(keys[e.which]) }); 23 / 73

Slide 24

Slide 24 text

Emoji Fruit Piano 24 / 73

Slide 25

Slide 25 text

Emoji Fruit Piano Patent Pending 25 / 73

Slide 26

Slide 26 text

26 / 73

Slide 27

Slide 27 text

Emoji Fruit Piano Demo 27 / 73

Slide 28

Slide 28 text

28 / 73

Slide 29

Slide 29 text

Spark Core 29 / 73

Slide 30

Slide 30 text

Spark.io Open source microcontroller Arduino compatible Wifi enabled Cloud certified® 30 / 73

Slide 31

Slide 31 text

The Internet Connected Hat 31 / 73

Slide 32

Slide 32 text

The Internet Connected Hat Patent Pending 32 / 73

Slide 33

Slide 33 text

33 / 73

Slide 34

Slide 34 text

Spark Core 34 / 73

Slide 35

Slide 35 text

Spark Core npm install sparky var Sparky = require('sparky') var core = new Sparky({ deviceId: 'your device id', token: 'your access token', }) core.digitalWrite('D7', 'HIGH'); core.digitalRead('D0', function(val){ console.log(val) }); 35 / 73

Slide 36

Slide 36 text

36 / 73

Slide 37

Slide 37 text

37 / 73

Slide 38

Slide 38 text

Arduino Uno 38 / 73

Slide 39

Slide 39 text

Johnny Five 39 / 73

Slide 40

Slide 40 text

40 / 73

Slide 41

Slide 41 text

Johnny-Five is jQuery for robots 41 / 73

Slide 42

Slide 42 text

Johnny-Five is jQuery for the physical world 42 / 73

Slide 43

Slide 43 text

Johnny-Five Supports over 99 hardware devices Started by Rick Waldren now has over 61 Contributers Most active JavaScript Robot Community 43 / 73

Slide 44

Slide 44 text

"A blinking light is the hello world of robotics." -Sara Chipps 44 / 73

Slide 45

Slide 45 text

Blink for Arduino int led = 13; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } 45 / 73

Slide 46

Slide 46 text

Blink for Johnny Five var five = require("johnny-five"); var board = new five.Board(); // Connect to the arudino board.on("ready", function() { // Create a new Led object on pin 13 var led = new five.Led(13); led.blink(); // blink! }); 46 / 73

Slide 47

Slide 47 text

Das Blinkenlights 47 / 73

Slide 48

Slide 48 text

48 / 73

Slide 49

Slide 49 text

ED 209 var ED = require('johhny-five/eg/ed.js'); // Create a new Enforcer Droid var ed209 = new ED({ // assign servos right: { hip: 9, foot: 11 }, left: { hip: 10, foot: 12 } }); // Stand upright! ed209.attn(); // Walk forward! ed209.fwd(); // Dance! ed209.dance(); // another Rick Waldron creation 49 / 73

Slide 50

Slide 50 text

ED 209 50 / 73

Slide 51

Slide 51 text

Parrot AR Drone 2.0 51 / 73

Slide 52

Slide 52 text

52 / 73

Slide 53

Slide 53 text

AR Drone npm install ar-drone 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(); }); 53 / 73

Slide 54

Slide 54 text

54 / 73

Slide 55

Slide 55 text

55 / 73

Slide 56

Slide 56 text

High-tech Observation & Orientation Device Interaction Enabler 56 / 73

Slide 57

Slide 57 text

High-tech Observation & Orientation Device Interaction Enabler H.O.O.D.I.E 57 / 73

Slide 58

Slide 58 text

High-tech Observation & Orientation Device Interaction Enabler H.O.O.D.I.E Patent Pending 58 / 73

Slide 59

Slide 59 text

59 / 73

Slide 60

Slide 60 text

60 / 73

Slide 61

Slide 61 text

H.O.O.D.I.E // we're already connected to the drone and arduino var button = new five.Button(7); var leftYFlexSensor = new five.Sensor("A0"); var rightYFlexSensor = new five.Sensor("A1"); var leftZFlexSensor = new five.Sensor("A2"); var rightZFlexSensor = new five.Sensor("A3"); // push the button to turn on flying button.on("up", function() { toggleFlying(); }); 61 / 73

Slide 62

Slide 62 text

H.O.O.D.I.E // Map the flex sensors to both the drone and the VR simulation leftYFlexSensor.on("read", function(err, value){ var a= five.Fn.map(value, 100, 500, -90, 90); leftY = five.Fn.constrain(a, -80, 80); io.sockets.emit('leftY', { angle: leftY, value: value }); move(); }); rightZFlexSensor.on("read", function(err, value){ var a = five.Fn.map(value, 500, 200, -60, 60); rightZ = five.Fn.constrain(a, -60, 60); io.sockets.emit('rightZ', { angle: rightZ, value: value }); move(); }); 62 / 73

Slide 63

Slide 63 text

63 / 73

Slide 64

Slide 64 text

Wrapping up As web developers, you are in the perfect position for the future of internet connect devices. 64 / 73

Slide 65

Slide 65 text

Wrapping up As web developers, you are in the perfect position for the future of internet connect devices. This new breed of hardware and software brings jQuery-like levels of accessibility to Hardware Hacking. 65 / 73

Slide 66

Slide 66 text

Wrapping up As web developers, you are in the perfect position for the future of internet connect devices. This new breed of hardware and software brings jQuery-like levels of accessibility to Hardware Hacking. Making things with you hands is incredibly rewarding 66 / 73

Slide 67

Slide 67 text

67 / 73

Slide 68

Slide 68 text

NodeBots Any robot controlled by Node.js (or JS in general) Coined by Chris Willams in "Rise of JS Robotics" Cool Logo 68 / 73

Slide 69

Slide 69 text

NodeBots Events Chapters all over the world (4 countries, 6 cities) Reach out to Oli Evans (@olizilla) about NodeBots London Start a new chapter near you with just a github pull request? Nodebots are better with friends 69 / 73

Slide 70

Slide 70 text

70 / 73

Slide 71

Slide 71 text

NodeCopter AR Drones controlled with nodejs Hackdays with flying robots Community event (affordable & inclusive) Learning, sharing, fun and being nice to each other 71 / 73

Slide 72

Slide 72 text

Get out the and start hacking! 72 / 73

Slide 73

Slide 73 text

Thanks @teabass @reconbot github.com/andrew/jquery-uk 73 / 73