Run your JavaScript app for years on a coin cell - JSConf.asia 2016
-
Upload
jan-jongboom -
Category
Internet
-
view
1.373 -
download
1
Transcript of Run your JavaScript app for years on a coin cell - JSConf.asia 2016
![Page 1: Run your JavaScript app for years on a coin cell - JSConf.asia 2016](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/1.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/2.jpg)
Developer EvangelistInternet of Things
![Page 3: Run your JavaScript app for years on a coin cell - JSConf.asia 2016](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/3.jpg)
![Page 4: Run your JavaScript app for years on a coin cell - JSConf.asia 2016](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/4.jpg)
JavaScript inside
![Page 5: Run your JavaScript app for years on a coin cell - JSConf.asia 2016](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/5.jpg)
![Page 6: Run your JavaScript app for years on a coin cell - JSConf.asia 2016](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/6.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/7.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/8.jpg)
YES, WE CAN!
![Page 9: Run your JavaScript app for years on a coin cell - JSConf.asia 2016](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/9.jpg)
microcontrollers
![Page 10: Run your JavaScript app for years on a coin cell - JSConf.asia 2016](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/10.jpg)
![Page 11: Run your JavaScript app for years on a coin cell - JSConf.asia 2016](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/11.jpg)
![Page 12: Run your JavaScript app for years on a coin cell - JSConf.asia 2016](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/12.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/13.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/14.jpg)
$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](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/15.jpg)
![Page 16: Run your JavaScript app for years on a coin cell - JSConf.asia 2016](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/16.jpg)
www.microbit.co.uk
![Page 17: Run your JavaScript app for years on a coin cell - JSConf.asia 2016](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/17.jpg)
![Page 18: Run your JavaScript app for years on a coin cell - JSConf.asia 2016](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/18.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/19.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/20.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022020119/5872c7411a28ab0c718b6715/html5/thumbnails/21.jpg)
Thank you!http://mbed.com/js
@janjongboom