Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Javascript Robotics

You're reading from   Learning Javascript Robotics Design, build, and program your own remarkable robots with JavaScript and open source hardware

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher
ISBN-13 9781785883347
Length 160 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Kassandra Perch Kassandra Perch
Author Profile Icon Kassandra Perch
Kassandra Perch
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Started with JS Robotics 2. Working with Johnny-Five FREE CHAPTER 3. Using Digital and PWM Output Pins 4. Using Specialized Output Devices 5. Using Input Devices and Sensors 6. Moving Your Bot 7. Advanced Movement with the Animation Library 8. Advanced Components – SPI, I2C, and Other Devices 9. Connecting NodeBots to the World, and Where to Go Next Index

Wiring up an external LED

For our first hardware project, we're going to wire an LED to the Arduino. An LED, or a Light Emitting Diode, is a component that lights up when electric current is passed through it. They come in many colors and sizes and are one of the most easy-to-use and versatile components in hobbyist robotics.

Setting up the hardware

First, take an LED. We'll determine the positive and negative leads of the LED—for this component, it's straightforward: the positive lead is longer than the negative lead.

Setting up the hardware

Determining the positive and negative ends of an LED

To wire the LED to an Arduino, place the positive lead on pin 11 and the negative lead on the pin marked GND, just like in the following diagram:

Setting up the hardware

Wiring up our LED

You can also use a breadboard if you wish to—it will look like the following:

Setting up the hardware

Wiring an LED with a breadboard

Now that we've wired up the LED, we're going to make it blink as we did in the last chapter. The script looks very familiar...

You have been reading a chapter from
Learning Javascript Robotics
Published in: Nov 2015
Publisher:
ISBN-13: 9781785883347
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image