# Johnny Five, how to light a LED

> Learn how to light and blink an LED on an Arduino using Johnny Five and Node.js, creating a Board and a Led on pin 13 and calling led.blink().

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2021-04-27 | Topics: [JavaScript](https://flaviocopes.com/tags/js/) | Canonical: https://flaviocopes.com/johnny-five-light-led/

> This post is part of the Johnny Five series. [See the first post here](https://flaviocopes.com/johnny-five/).

Create a folder and initialize `npm`:

```sh
npm init -y
```

Install Johnny Five locally:

```sh
npm install johnny-five
```

Now create a `app.js` file, with this content:

```js
const { Board, Led } = require("johnny-five")
const board = new Board()

board.on("ready", () => {
  const led = new Led(13)
  led.blink()
})
```

This program initializes a new board by calling `new Board()`.

When the board is ready the `ready` event is fired on the `board` object, and in the callback function we can do what our app is supposed to do.

In this simple example, we initialize a new LED on pin 13, by initializing a new `Led` object, and we blink it (we turn it on/off indefinitely).

The `Led` object and the `Board` object are two of the many functionality offered by the Johnny Five library.

Pin 13 on the Arduino Uno board is the pin that is connected to the built-in LED.

Now run the program using `node app.js`:

![Arduino Uno board with built-in LED glowing red showing successful Johnny Five connection](https://flaviocopes.com/images/johnny-five-light-led/IMG_9067.jpg)

And you should see the led turn on and off!

You can also attach a real LED by connecting the negative pin to GND (0V) and the positive pin to the pin 13:

![Arduino connected to breadboard with external red LED and resistor wired to pin 13](https://flaviocopes.com/images/johnny-five-light-led/IMG_9070.jpg)

> Note that I used a resistor, to limit the amount of current that flows through the LED.

To stop the program from running, hit ctrl-C twice:

![Terminal output showing Board Closing message and instructions to press Ctrl+C to exit Johnny Five](https://flaviocopes.com/images/johnny-five-light-led/Screenshot_2020-03-26_at_11.49.25.png)
