O'Reilly logo

Learning JavaScript Robotics by Kassandra Perch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Multiple pins with several LEDs

For the next project, we're going to look at the Led object API and test several different methods. This is one of the benefits of Johnny-Five—abstraction. If you can understand the concept of an LED, you can use the Johnny-Five LED object without thinking about the underlying pins or timings. Let's go over the methods that we'll use for our project:

  • on() and off(): These turn an LED on and off. Under abstraction, this sets the pin that is wired to the LED to HIGH and LOW, respectively. We'll be using these in the REPL.
  • blink(time): This turns an LED on and off at a given interval. strobe() and blink() are aliases of each other and do the same thing.
  • pulse(time): This will cause an LED to pulse on and off in an eased ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required