Why use JavaScript in Hardware? GoTo Conf - Berlin

40
Jon McKay @jonmckay Hardware Side JavaScript Technical Machine

description

A majority of this presentation was live demos of hardware in action (how to blink lights, send HTTP requests to an Express server, attach sensors, and an integration demo) but it also quickly goes over some reasons why you should consider using JavaScript to prototype hardware.

Transcript of Why use JavaScript in Hardware? GoTo Conf - Berlin

Page 1: Why use JavaScript in Hardware? GoTo Conf - Berlin

Jon McKay@jonmckay

Hardware Side JavaScript

Technical Machine

Page 2: Why use JavaScript in Hardware? GoTo Conf - Berlin

“Forgive me for not being hip but why try so hard to put JS in new places?”

- @farnsworth (HackerNews user)

Source: https://news.ycombinator.com/item?id=6214838

Page 3: Why use JavaScript in Hardware? GoTo Conf - Berlin

Source: http://adambard.com/blog/top-github-languages-2014/

A: Flourishing Ecosystem

Page 4: Why use JavaScript in Hardware? GoTo Conf - Berlin

Source: http://npmjs.org

A: Prolific Community

Page 5: Why use JavaScript in Hardware? GoTo Conf - Berlin

A: Accessibility

// turn on an LEDscu_pinmux(g_APinDescription[ulPin].port,

g_APinDescription[ulPin].pin,PIN_MODE | pin_modes[ulPin],g_APinDescription[ulPin].func);

GPIO_SetDir(g_APinDescription[ulPin].portNum,1 << (g_APinDescription[ulPin].bitNum),GPIO_INPUT);

GPIO_SetValue(g_APinDescription[ulPin].portNum, 1 << g_APinDescription[ulPin].bitNum);

// turn on an LEDvar tessel = require('tessel');tessel.led[0].high();

Page 6: Why use JavaScript in Hardware? GoTo Conf - Berlin

A: Event Based

var tessel = require('tessel');var led = tessel.led[0];var button = tessel.button;

// Sleep until the button is pressedbutton.on('press', led.toggle.bind(led));

Page 7: Why use JavaScript in Hardware? GoTo Conf - Berlin

“In my view, the popularity of JavaScript comes down to two things:

Interactivity and Instant Gratification”

- @naunga (HackerNews user)

Source: https://news.ycombinator.com/item?id=6217993

Page 8: Why use JavaScript in Hardware? GoTo Conf - Berlin

JavaScript on hardware is ideal for prototyping new ideas.

Page 9: Why use JavaScript in Hardware? GoTo Conf - Berlin
Page 10: Why use JavaScript in Hardware? GoTo Conf - Berlin

● The Intel Edison module will initially support development with Arduino* and C/C++, followed by Node.JS, Python, RTOS, and Visual Programming support in the near future.

Page 11: Why use JavaScript in Hardware? GoTo Conf - Berlin

● Blinky

● HTTP

● Modules

Live Demo Time!

Page 12: Why use JavaScript in Hardware? GoTo Conf - Berlin

Case Study:

Tessel Sign

Parts:

● Tessel PCBs● Laser Cut

Logo● Neopixels● Tessel

Page 14: Why use JavaScript in Hardware? GoTo Conf - Berlin
Page 15: Why use JavaScript in Hardware? GoTo Conf - Berlin

Let’s build something.

Page 16: Why use JavaScript in Hardware? GoTo Conf - Berlin

Questions?

Page 17: Why use JavaScript in Hardware? GoTo Conf - Berlin

[email protected] @technicalhumans

http://tessel.io

Page 18: Why use JavaScript in Hardware? GoTo Conf - Berlin

Appendix

Page 19: Why use JavaScript in Hardware? GoTo Conf - Berlin

How does Tessel

Work?

Page 20: Why use JavaScript in Hardware? GoTo Conf - Berlin
Page 21: Why use JavaScript in Hardware? GoTo Conf - Berlin

CC3000 WiFi ChipConstant Connection

Remote DeploymentMobile Friendly

32MB of Flash & RAMJavaScript-powered

Node.js compatible

Cortex M ProcessorComputation

Horizontal Module HeaderPlug n Play Capabilities

Page 22: Why use JavaScript in Hardware? GoTo Conf - Berlin
Page 23: Why use JavaScript in Hardware? GoTo Conf - Berlin
Page 24: Why use JavaScript in Hardware? GoTo Conf - Berlin
Page 25: Why use JavaScript in Hardware? GoTo Conf - Berlin

1(JS) 2(Lua)

3 4 5

6

Page 26: Why use JavaScript in Hardware? GoTo Conf - Berlin

User Land

Driver

Lua Binding declaration

Page 27: Why use JavaScript in Hardware? GoTo Conf - Berlin

Lua Binding declaration

Lua-C bindings

Firmware

Page 28: Why use JavaScript in Hardware? GoTo Conf - Berlin

Why not use V8?

Page 29: Why use JavaScript in Hardware? GoTo Conf - Berlin

● Chrome’s JS engine● C++● ~10mb memory

required for each instance

● POSIX/Win32 environment

Page 30: Why use JavaScript in Hardware? GoTo Conf - Berlin

● Embeddable language

● Written in C● ~30kb memory● Highly portable● LuaJIT is 10x-100x

faster than LuaVM

Page 31: Why use JavaScript in Hardware? GoTo Conf - Berlin

What about Post-

Prototyping?

Page 32: Why use JavaScript in Hardware? GoTo Conf - Berlin
Page 33: Why use JavaScript in Hardware? GoTo Conf - Berlin

Fractal$40

$5

Page 34: Why use JavaScript in Hardware? GoTo Conf - Berlin

Read More About Fractal:https://github.com/technicalmachine/fractal-docs

Page 35: Why use JavaScript in Hardware? GoTo Conf - Berlin

Creation of Tessel

Sign

Page 36: Why use JavaScript in Hardware? GoTo Conf - Berlin
Page 39: Why use JavaScript in Hardware? GoTo Conf - Berlin
Page 40: Why use JavaScript in Hardware? GoTo Conf - Berlin