Obtaining documentation, wiring diagrams, and so on

A good skill to have when building your own Johnny-Five projects is finding code and wiring diagrams for the components that you'd like to use. Luckily, the www.johnny-five.io website and the project provide a thorough and top-notch documentation right there on the site!

Let's take a look at the LCD documentation on the site to prepare us for building our project:

  1. In the header of the site, click on the API tab.
  2. Then, you'll see a list of components on the left (if you're on a desktop) or at the top (if you're on a tablet or phone).
  3. Find and click the LCD entry in this list.
    Obtaining documentation, wiring diagrams, and so on

    The API documentation page

Once you are on the LCD page, you'll see a bunch of different LCD components, a section on the LCD API, and some links to examples at the bottom. There is a page like this for every component in Johnny-Five, so it's easy to find out how to get started with just about every component that has already been adapted.

Let's take a look at the LCD API that we'll use to work on our next project.

The constructor takes several parameters, depending on the type of LCD you are using. We'll cover the pin options in detail when we build our project, but rows and columns are something that we can knock out now. Whether you can read it from the packaging or estimate it by looking at the number of character spaces, go ahead and figure out how many rows and columns you have on your LCD.

There's also a backlight pin option; most LCDs have a backlight and some have an RGB backlight. If you have no backlight, you do not need to initialize this parameter; if you have a single-color backlight, you'll want to note that you need to set this option.

If you have an LCD with an RGB backlight, you'll want to look at the Led.RGB class under the LED subheader and instantiate this yourself—we'll take a peek at the actual code for this in the project section, but go ahead and look at the RGB LED API to just be sure.

Once you've made yourself familiar with looking up information on the Johnny-Five website, you'll have unlocked a wide range of information for your projects. Is something missing? The entire page is open source and available on GitHub (https://github.com/bocoup/johnny-five.io), so you can file issues and make pull requests with your own examples.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset