Arduino introduction: Breadboards and multiple LEDs

Planning
Step 1
In this lesson, we will learn to control multiple LEDs at the same time

Get yourself four LEDs from the supply area.

Can you plug them all in to the Arduino and turn them all on? Why not?

Temp1485482780

We'll talk about the solution for this in the next steps

Planning
Step 2
You'll notice there are not enough ground pins on our Arduino for all of the LEDs
Temp1485483128

Since every component is going to need to be attached to GND, we'll need a way to create lots of GNDs...

Information
Step 3
The breadboard

A breadboard is an ordered collection of groups of pins.

Notice here how the groups are connected:

  • The center pins are connected in rows of five
  • The edge pins are connected in columns all the way down
Temp1485483481
Information
Step 4
This is what a breadboard looks like if you took off the plastic cover
Temp1485550859

Notice how the groups are connected and how they are separated.

Information
Step 5
If you wanted to power an LED using a breadboard it could look like this

The blue wire supplies ground to the entire row it's plugged in to.
The red wire supplies power to its entire row.

Temp1485484375
Step 6
We're going to plug our ground source into the blue column on the side

The red and blue columns are for power and ground sources. These become known as the rails.

Create a ground rail by plugging a GND pin into the blue column.

Temp1485552058 Temp1485551499

Always use blue for GND and red for power. We don't want to mix these up!

Step 7
Plug in your first LED so that each of its legs are in different rows

It doesn't matter which rows you use! It just matters that the two legs are in separate rows.

Temp1485553422 Temp1485553208
Step 8
Now attach the Arduino's pin 13 and your ground rail to the appropriate rows
  • The row with the short leg of the LED is attached to the ground rail.
  • The row with the long leg of the LED is attached to digital pin 13.
Check Your Work
Step 9
Make sure your LED lights up just like it was in the previous lesson
Temp1492130163
Challenge
Step 10
Challenge 1: Get four LEDs attached and lit up

You'll need to use multiple digitalWrite() functions.

Remember how digitalWrite() works

digitalWrite( [pinNumber], [HIGH or LOW]

HINT: Each pin will need to be set to OUTPUT mode in the setup() function!

Temp1492130087
Challenge
Step 11
Challenge 2: Lights on, lights off

Program your Arduino so that each LED lights up one at a time until they're all ON.

Once they are all ON, have them turn OFF one at a time, in the same order which they lit up in.

Below is a video showing what your final product should look like:
(You can pause it so that the lights stop blinking)

HINT: Remember how the delay() function works! You can use it to make your program wait some number of milliseconds.

delay( [number of milliseconds] )
Arduino introduction: Breadboards and multiple LEDs Info

Account

MVCode Clubs

Created By

Newprofile jamie

Course:

Introduction to Robotics: Remote Control Car

Access Level

premium

For Teachers and Schools

Teach coding to your students with MVCode Teach

MVCode offers an integrated product designed to teach coding to students.

Learn more about MVCode Teach