The LED object is usually the first thing in Johnny-Five that people look through the documentation for. It's also a great object to use to outline the general structure of the object documentation. Let's take a look at each section and get a grasp of where we should look for what later:
- Parameters: This section addresses the parameters that need to be passed into the object constructor, and what form they need to be in (order, object key, and so on).
- Shapes: These are the fields attached to the constructed object that may be useful to the user in writing their code. They can be read-only, and are marked if this is the case.
- Component Initialization: This is usually a piece of sample code, but it's always a description of how to construct a common usage of the object in question. If there are multiple controllers for a specific component, they are enumerated with examples for each controller. This will come in handy for our GPIO expander board.
- Usage: This is a sample code denoting how to use the most basic functions of an object; for the LED, this is the blink function, and for sensors, this would show the function that you would usually use to get readings from the sensor.
- API: This is a full documentation of every function available to the object, including the parameters and intended result.
- Events: Many objects emit events (such as the board's ready event); this section details when they will fire.
- Examples: The Johnny-Five community is a fantastic source of examples, and the examples that are relevant to the object in question will be cataloged and linked in this section.
Take a moment to get used to the LED documentation (http://johnny-five.io/api/led/), because the Led.RGB object is essentially a subclass of the LED object, and will inherit many of its functions.