Holds all the parts and joins them, like a LEGO baseplate.
Breadboard
Our building board
nested loops and pattern tables
Show different bar graph patterns stored in tables and loops.

Pin connections
| Part 1 | Part 2 | |
|---|---|---|
Arduino pin 2 | → | LED bar graph A1 |
Arduino pin 3 | → | LED bar graph A2 |
Arduino pin 4 | → | LED bar graph A3 |
Arduino pin 5 | → | LED bar graph A4 |
Arduino pin 6 | → | LED bar graph A5 |
Arduino pin 7 | → | LED bar graph A6 |
Arduino pin 8 | → | LED bar graph A7 |
Arduino pin 9 | → | LED bar graph A8 |
Arduino pin 10 | → | LED bar graph A9 |
Arduino pin 11 | → | LED bar graph A10 |
LED bar graph C10 | → | Arduino GND |
Let's make light shapes!
A row of lights shows stripes, then pairs, then a glowing block — again and again.
Big screens and scoreboards show saved shapes just like this!
The problem
Typing every single light by hand is a lot of work. Let's save the shapes and reuse them.
Think of it like
It's like a coloring book — the shapes are drawn once, and you fill them in again and again.
Holds all the parts and joins them, like a LEGO baseplate.
Breadboard
Our building board
It reads the saved shapes and tells the lights what to do.
Arduino
The brain
Ten little lights in a line that make the shapes.
LED bar graph
The row of lights
Show the stripes
patternA is a list of 1s and 0s. A 1 means a light glows and a 0 means it stays dark — together they make stripes.
showPattern(patternA); delay(400);
Show the pairs
patternB is a different list, so the lights make a different shape — two on, two off.
showPattern(patternB); delay(400);
Show the middle block
patternC lights up the middle lights. Then loop() jumps back to the stripes and does it all again!
showPattern(patternC); delay(400);
Then loop back to step 1
Follow these steps in order. Match the wires to the colors shown.
Place Breadboard
Place the Breadboard (bb1) on the breadboard.
Breadboard placed — build like the real world!
Place Arduino
Place the Arduino (uno) on the breadboard.
Arduino placed — ready to build!
Place LED bar graph
Place the LED bar graph (bar1) on the breadboard.
Row of ten lights placed — now let's wire them up!
Connect Arduino pin 2 to LED bar graph (bar1) A1
Arduino pin 2 to segment 1's anode (A1)
Tip: Arduino pin 2 to segment 1's anode (A1)
Light 1 wired!
Connect Arduino pin 3 to LED bar graph (bar1) A2
Arduino pin 3 to segment 2's anode (A2)
Tip: Arduino pin 3 to segment 2's anode (A2)
Light 2 wired!
Connect Arduino pin 4 to LED bar graph (bar1) A3
Arduino pin 4 to segment 3's anode (A3)
Tip: Arduino pin 4 to segment 3's anode (A3)
Light 3 wired!
Connect Arduino pin 5 to LED bar graph (bar1) A4
Arduino pin 5 to segment 4's anode (A4)
Tip: Arduino pin 5 to segment 4's anode (A4)
Light 4 wired!
Connect Arduino pin 6 to LED bar graph (bar1) A5
Arduino pin 6 to segment 5's anode (A5)
Tip: Arduino pin 6 to segment 5's anode (A5)
Light 5 wired!
Connect Arduino pin 7 to LED bar graph (bar1) A6
Arduino pin 7 to segment 6's anode (A6)
Tip: Arduino pin 7 to segment 6's anode (A6)
Light 6 wired!
Connect Arduino pin 8 to LED bar graph (bar1) A7
Arduino pin 8 to segment 7's anode (A7)
Tip: Arduino pin 8 to segment 7's anode (A7)
Light 7 wired!
Connect Arduino pin 9 to LED bar graph (bar1) A8
Arduino pin 9 to segment 8's anode (A8)
Tip: Arduino pin 9 to segment 8's anode (A8)
Light 8 wired!
Connect Arduino pin 10 to LED bar graph (bar1) A9
Arduino pin 10 to segment 9's anode (A9)
Tip: Arduino pin 10 to segment 9's anode (A9)
Light 9 wired!
Connect Arduino pin 11 to LED bar graph (bar1) A10
Arduino pin 11 to segment 10's anode (A10)
Tip: Arduino pin 11 to segment 10's anode (A10)
All ten lights are wired!
Connect LED bar graph (bar1) C10 to Arduino GND
One wire from the bar graph's common cathode side to Arduino GND — all segments share this ground inside the part
Tip: One wire from the bar graph's common cathode side to Arduino GND — all segments share this ground inside the part
Circuit complete — the shapes can play!
The saved shapes
const byte patternA[] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0};
const byte patternB[] = {1, 1, 0, 0, 1, 1, 0, 0, 1, 1};
const byte patternC[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0};Each list holds 1s and 0s. A 1 means a light glows and a 0 means it stays dark. A new shape is just a new list!
The showPattern helper
void showPattern(const byte *pat) {
for (int i = 0; i < NUM_LEDS; i++) {
digitalWrite(FIRST_PIN + i, pat[i] ? HIGH : LOW);
}
}This little helper reads a shape's list and lights each light ON or OFF. We reuse it for every shape.
Play the shapes
void loop() {
showPattern(patternA);
delay(400);
showPattern(patternB);
delay(400);
showPattern(patternC);
delay(400);
}loop() shows shape A, then B, then C, with a wait between each. That is the whole repeating light show.
const int FIRST_PIN = 2;
const int NUM_LEDS = 10;
const byte patternA[] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0};
const byte patternB[] = {1, 1, 0, 0, 1, 1, 0, 0, 1, 1};
const byte patternC[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
void showPattern(const byte *pat) {
for (int i = 0; i < NUM_LEDS; i++) {
digitalWrite(FIRST_PIN + i, pat[i] ? HIGH : LOW);
}
}
void setup() {
for (int i = 0; i < NUM_LEDS; i++) {
pinMode(FIRST_PIN + i, OUTPUT);
}
}
void loop() {
showPattern(patternA);
delay(400);
showPattern(patternB);
delay(400);
showPattern(patternC);
delay(400);
}
Q1. Which part runs again and again?
Q2. Why do we save the shapes in lists like patternA?
Speed up the show — change all the delay(400) numbers to delay(200).
Hint: There are three delay(400) lines inside loop().
Change the first shape — flip a 1 to a 0 (or a 0 to a 1) on line 3.
Hint: Edit the numbers inside the curly braces of patternA.
A line-by-line tour of the sketch — the same steps as in Robot Gurukul Studio.
Program overview
Big idea
Every Arduino program has a top part, a setup() part that runs once, and a loop() part that runs again and again.
In this project
A row of ten lights shows three saved shapes, then starts over.
Tip
Read from the top to the bottom. Tap any word or line if you need help!
const int FIRST_PIN = 2;
const int NUM_LEDS = 10;
const byte patternA[] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0};
const byte patternB[] = {1, 1, 0, 0, 1, 1, 0, 0, 1, 1};
const byte patternC[] = {0, 0, 0, 0, 1, 1, 1, 1, 0, 0};
void showPattern(const byte *pat) {
for (int i = 0; i < NUM_LEDS; i++) {
digitalWrite(FIRST_PIN + i, pat[i] ? HIGH : LOW);
}
}setup()
Big idea
setup() runs one time when the board turns on.
In this project
It gets all ten light pins (starting at pin 2) ready.
Why here
Things we do only once go inside setup().
void setup() {
for (int i = 0; i < NUM_LEDS; i++) {
pinMode(FIRST_PIN + i, OUTPUT);
}
}loop()
Big idea
loop() runs again and again, forever.
In this project
This is where the three light shapes take turns on the bar.
Why here
Things that repeat go inside loop().
void loop() {
showPattern(patternA);
delay(400);
showPattern(patternB);
delay(400);
showPattern(patternC);
delay(400);
}
Try this: Change a delay number inside loop(), then press Run to make each shape hold longer.
pinMode
Big idea
pinMode tells a pin if it will listen or push power out.
In this project
It makes each light pin ready to push power to a light.
Why here
It goes in setup() because we only set it once.
pinMode(FIRST_PIN + i, OUTPUT);
digitalWrite
Big idea
digitalWrite turns a pin ON or OFF.
In this project
It looks at the shape's list and lights each light ON for a 1 or OFF for a 0.
Why here
It goes in loop() so the shapes can keep changing.
digitalWrite(FIRST_PIN + i, pat[i] ? HIGH : LOW);
delay
Big idea
delay means wait. Nothing else happens while it waits.
In this project
It holds each shape on screen long enough for you to see it.
Why here
Right after we show a shape.
delay(400);