run your javascript app for years on a coin cell - jsconf.asia 2016

21
Running your JS app JSConf.asia 25 November 2016 for years on a coin cell

Upload: jan-jongboom

Post on 21-Apr-2017

1.381 views

Category:

Internet


0 download

TRANSCRIPT

Page 1: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

Running your JS app

JSConf.asia 25 November 2016

for years on a coin cell

Page 2: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

Developer EvangelistInternet of Things

Page 3: Run your JavaScript app for years on a coin cell - JSConf.asia 2016
Page 4: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

JavaScript inside

Page 5: Run your JavaScript app for years on a coin cell - JSConf.asia 2016
Page 6: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

We're using quad-core machines to run a temperature sensor

Page 7: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

0.137 mA

220 mARaspberry Pi 3 (idle)

One year on AA battery

Page 8: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

YES, WE CAN!

Page 9: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

microcontrollers

Page 10: Run your JavaScript app for years on a coin cell - JSConf.asia 2016
Page 11: Run your JavaScript app for years on a coin cell - JSConf.asia 2016
Page 12: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

mbedUnify microcontroller development > 100 boards supported Lot of APIs / libaries / community

But... in C++

Developed by Samsung JS VM for constrained devices

Can run in 64K of RAM

Written in C++

JavaScript on mbed

Page 13: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

JS on mbed - Best of both worlds

• Runs on > 40 boards already

• Drivers, OS, critical paths in C++

• Deep sleep built-in

• Big library ecosystem, and many connectivity methods

• Application code can run in JS, and interop with C++

Page 14: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

$gitclonehttps://github.com/armmbed/mbed-js-example

$gulp--target=NRF52_DK

#Dragfileontoboard(mountsasmassstorage)

1varled=DigitalOut(LED1);23setInterval(function(){4led.write(lead.read()?0:1);5},1000);

Page 15: Run your JavaScript app for years on a coin cell - JSConf.asia 2016
Page 16: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

www.microbit.co.uk

Page 17: Run your JavaScript app for years on a coin cell - JSConf.asia 2016
Page 18: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

Abstracting away many microcontroller 'problems'Thread management, interrupts, context switching, power management

Page 19: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

0.137 mA

220 mARaspberry Pi 3 (idle)

One year on AA battery

0.020 mAJS on mbed beacon1s interval, lowest power mode, nRF52-DK

Page 20: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

Current state

• > 40 boards supported (from 9$)

• Need C++ / JS bindings for libraries

• Apache 2.0 licensed

• Very beta... But please help us!

http://mbed.com/js

Page 21: Run your JavaScript app for years on a coin cell - JSConf.asia 2016

Thank you!http://mbed.com/js

@janjongboom