Chapter 8. Node.js Libraries for Hardware

In this chapter, we’ll continue programming hardware with JavaScript. By now, you have made some basic steps to set up hardware and a software toolchain. Let’s go beyond the blinking LED. This chapter begins by introducing a library to communicate with an embedded device over a serial port.

Next, after sending and reading bytes from a device, it is time to look into representations of components in JavaScript. For this, the library Johnny-Five will get you going.

Finally, this chapter closes with some ideas and instructions on using your new knowledge to experiment in a variety of directions.

Most examples will still work with a simple Arduino Uno. But with a board that supports embedded Linux, you can run the examples inside an embedded device too. As for components, the Seeed Studio Grove Kit should cover most of the examples for now. The Grove Kit shield lets you quickly connect components such as buttons and outputs to your base board.

Note

The Johnny-Five Inventor’s Kit includes a set of hardware with tutorials that explain how to use Tessel 2 with Johnny-Five. You can see some experiments using Johnny-Five on the Tessel 2 (and associated hardware kit) in the “Experiment Guide for the Johnny-Five Inventor’s Kit”.

You’ll also see some examples that are based on the LibMRAA library. Don’t be confused by its name—it does not (yet) have a meaning. What’s important is that this library provides bindings for JavaScript to low-level pin ...

Get Node.js for Embedded Systems now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.