Heads up! To view this whole video, sign in with your Courses Plus account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
The second JavaScript IoT strategy is to use JavaScript microcontrollers - small efficient single-purpose computers.
JavaScript Microcontroller Runtimes
Examples of JavaScript Microcontrollers
ESP8266 Flashing Tools
- esptool - Python CLI
- Flasher.js - Cross-platform Desktop Application
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Microcontrollers are specialized
instant-on computers with small amounts of
0:00
processing power and RAM, but
they have incredibly fast IEO.
0:05
Because they are specialized for single
uses, they are often power efficient.
0:10
The low amount of processing power doesn't
prevent them from running an interpreted
0:14
language though.
0:18
There are a number of specialized
JavaScript Runtimes that can run on
0:20
microcontrollers, like Espruino,
Smart.js, XS6 and Samsung's JerryScript.
0:25
The Espruino JavaScript Runtime first
came out on the Espruino board.
0:32
This wasn't WiFi enabled and
cost around $40.
0:37
The Espruino Pico again ran
the JavaScript Runtime, but
0:41
didn't have any WiFi connectivity either.
0:45
It was however, smaller and
more embeddable.
0:48
It was also cheaper at $25.
0:51
The Espruino Runtime has been ported
to work with other microcontrollers,
0:54
like the ESP8266, which is
a microcontroller that is WiFi enabled and
0:58
only costs $2 and
here it is next to a quarter.
1:04
Because of its low cost and connectivity,
it's been embedded in products
1:08
like smart plugs, where you can switch
things off via an app on your phone.
1:13
In order to get up and
running with development, companies like
1:17
Adafruit have created development breakout
boards to aid in rapid prototyping.
1:21
This board enables you to
wire up components with ease.
1:26
The Feather HUZZAH has
an ESP8266 embedded in it,
1:30
with a place for a rechargeable
battery and charging circuitry.
1:34
The ESP8266 doesn't have JavaScript on it.
1:38
You need to install it on the device.
1:43
This installation process
is called flashing.
1:45
You can use the Python based tool, the ESP
tool or a graphical user interface,
1:48
Flasher.js, to install
a JavaScript Runtime on the device.
1:54
The Kinoma Element comes with ES6 built
into it, no flashing is required.
1:59
It costs around $25,
and has WiFi built in.
2:05
The pros for microcontrollers
are that they're instant-on,
2:09
they have a faster IO than
single board computers, and
2:13
they're small and embeddable, so you can
put them in lots of different projects.
2:17
Unfortunately, the tooling
is immature right now.
2:22
You have to download specific editors for
each one of these Runtimes.
2:25
If you're used to using MPM and
you're an editor you're out of luck here.
2:30
If you wanted to use a sensor or
a screen from a third party,
2:34
there is limited support in terms
of libraries for JavaScript.
2:37
If you are using C or C++, most vendors
have libraries and example code.
2:41
You often find yourself
having to write the code for
2:47
yourself to support off the shelf devices.
2:50
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up