Mission 10 · Stage 1

Mini Light Show

timed show sequences

Run a timed light show sequence on a bar graph.

Mini Light Show circuit diagram

Pin connections

Part 1Part 2

LED bar graph

A1

→

Breadboard

12t e

LED bar graph

C1

→

Breadboard

12b h

LED bar graph

A2

→

Breadboard

13t e

LED bar graph

C2

→

Breadboard

13b h

LED bar graph

A3

→

Breadboard

14t e

LED bar graph

C3

→

Breadboard

14b h

LED bar graph

A4

→

Breadboard

15t e

LED bar graph

C4

→

Breadboard

15b h

LED bar graph

A5

→

Breadboard

16t e

LED bar graph

C5

→

Breadboard

16b h

LED bar graph

A6

→

Breadboard

17t e

LED bar graph

C6

→

Breadboard

17b h

LED bar graph

A7

→

Breadboard

18t e

LED bar graph

C7

→

Breadboard

18b h

LED bar graph

A8

→

Breadboard

19t e

LED bar graph

C8

→

Breadboard

19b h

LED bar graph

A9

→

Breadboard

20t e

LED bar graph

C9

→

Breadboard

20b h

LED bar graph

A10

→

Breadboard

21t e

LED bar graph

C10

→

Breadboard

21b h

Arduino

pin 2

→

Breadboard

12t a

Arduino

pin 3

→

Breadboard

13t a

Arduino

pin 4

→

Breadboard

14t a

Arduino

pin 5

→

Breadboard

15t a

Arduino

pin 6

→

Breadboard

16t a

Arduino

pin 7

→

Breadboard

17t a

Arduino

pin 8

→

Breadboard

18t a

Arduino

pin 9

→

Breadboard

19t a

Arduino

pin 10

→

Breadboard

20t a

Arduino

pin 11

→

Breadboard

21t a

Breadboard

12b j

→

Breadboard

bn 12

Breadboard

13b j

→

Breadboard

bn 13

Breadboard

14b j

→

Breadboard

bn 14

Breadboard

15b j

→

Breadboard

bn 15

Breadboard

16b j

→

Breadboard

bn 16

Breadboard

17b j

→

Breadboard

bn 17

Breadboard

18b j

→

Breadboard

bn 18

Breadboard

19b j

→

Breadboard

bn 19

Breadboard

20b j

→

Breadboard

bn 20

Breadboard

21b j

→

Breadboard

bn 21

Breadboard

bn 24

→

Arduino

GND

See it

Let's put on a light show!

Lights fill up, empty out, then flash all together — your own mini light show!

Stage lights and big signs play timed shows just like this!

The story

The problem

One pattern is fun, but a real show puts several fun parts together in order.

Think of it like

It's like a little dance routine — step one, step two, then a big finish!

Meet the parts

Holds the lights and joins their grounds on the blue line.

Breadboard

Our building board

Loading part…

It thinks and runs the whole light show.

Arduino

The brain

Loading part…

Ten little lights in a line that put on the show.

LED bar graph

The row of lights

Loading part…

How it works

1

Part 1 — fill up

The lights turn on one by one, from left to right, until the whole row is glowing.

digitalWrite(FIRST_PIN + i, HIGH);
delay(80);
2

Hold the full row

All the lights stay on together for a moment before the next part.

delay(500);
3

Part 2 — empty out

Now the lights turn off one by one, from right to left, until the row is dark.

digitalWrite(FIRST_PIN + i, LOW);
delay(80);
4

Part 3 — flash together

All the lights flash on and off three times — that is the big finish!

allOn(); delay(150); allOff(); delay(150);
5

Rest, then do it again

A nice long rest, then loop() jumps back and plays the whole show again!

delay(800);

Then loop back to step 1

Build the circuit

Follow these steps in order. Match the wires to the colors shown.

  1. 1

    Place Breadboard

    Place the Breadboard (bb1) on the breadboard.

    Breadboard placed.

    Loading part…
  2. 2

    Place Arduino

    Place the Arduino (uno) on the breadboard.

    Arduino placed — ready to build!

    Loading part…
  3. 3

    Place LED bar graph

    Place the LED bar graph (bar1) on the breadboard.

    Row of ten lights plugged into columns 12 to 21.

    Loading part…
  4. 4

    Connect Arduino pin 2 to Breadboard (bb1) anode (+)

    Arduino pin 2 to column 12. The light sits in 12 e.

    Tip: Arduino pin 2 to column 12. The light sits in 12 e.

  5. 5

    Connect Arduino pin 3 to Breadboard (bb1) anode (+)

    Arduino pin 3 to column 13. The light sits in 13 e.

    Tip: Arduino pin 3 to column 13. The light sits in 13 e.

  6. 6

    Connect Arduino pin 4 to Breadboard (bb1) anode (+)

    Arduino pin 4 to column 14. The light sits in 14 e.

    Tip: Arduino pin 4 to column 14. The light sits in 14 e.

  7. 7

    Connect Arduino pin 5 to Breadboard (bb1) anode (+)

    Arduino pin 5 to column 15. The light sits in 15 e.

    Tip: Arduino pin 5 to column 15. The light sits in 15 e.

  8. 8

    Connect Arduino pin 6 to Breadboard (bb1) anode (+)

    Arduino pin 6 to column 16. The light sits in 16 e.

    Tip: Arduino pin 6 to column 16. The light sits in 16 e.

  9. 9

    Connect Arduino pin 7 to Breadboard (bb1) anode (+)

    Arduino pin 7 to column 17. The light sits in 17 e.

    Tip: Arduino pin 7 to column 17. The light sits in 17 e.

  10. 10

    Connect Arduino pin 8 to Breadboard (bb1) anode (+)

    Arduino pin 8 to column 18. The light sits in 18 e.

    Tip: Arduino pin 8 to column 18. The light sits in 18 e.

  11. 11

    Connect Arduino pin 9 to Breadboard (bb1) anode (+)

    Arduino pin 9 to column 19. The light sits in 19 e.

    Tip: Arduino pin 9 to column 19. The light sits in 19 e.

  12. 12

    Connect Arduino pin 10 to Breadboard (bb1) anode (+)

    Arduino pin 10 to column 20. The light sits in 20 e.

    Tip: Arduino pin 10 to column 20. The light sits in 20 e.

  13. 13

    Connect Arduino pin 11 to Breadboard (bb1) anode (+)

    Arduino pin 11 to column 21. The light sits in 21 e.

    Tip: Arduino pin 11 to column 21. The light sits in 21 e.

  14. 14

    Connect Breadboard (bb1) 12b.j to Breadboard (bb1) bn.12

    Column 12 to the blue ground line. This ties light 1 to the shared ground.

    Tip: Column 12 to the blue ground line. This ties light 1 to the shared ground.

  15. 15

    Connect Breadboard (bb1) 13b.j to Breadboard (bb1) bn.13

    Column 13 to the blue ground line. This ties light 2 to the shared ground.

    Tip: Column 13 to the blue ground line. This ties light 2 to the shared ground.

  16. 16

    Connect Breadboard (bb1) 14b.j to Breadboard (bb1) bn.14

    Column 14 to the blue ground line. This ties light 3 to the shared ground.

    Tip: Column 14 to the blue ground line. This ties light 3 to the shared ground.

  17. 17

    Connect Breadboard (bb1) 15b.j to Breadboard (bb1) bn.15

    Column 15 to the blue ground line. This ties light 4 to the shared ground.

    Tip: Column 15 to the blue ground line. This ties light 4 to the shared ground.

  18. 18

    Connect Breadboard (bb1) 16b.j to Breadboard (bb1) bn.16

    Column 16 to the blue ground line. This ties light 5 to the shared ground.

    Tip: Column 16 to the blue ground line. This ties light 5 to the shared ground.

  19. 19

    Connect Breadboard (bb1) 17b.j to Breadboard (bb1) bn.17

    Column 17 to the blue ground line. This ties light 6 to the shared ground.

    Tip: Column 17 to the blue ground line. This ties light 6 to the shared ground.

  20. 20

    Connect Breadboard (bb1) 18b.j to Breadboard (bb1) bn.18

    Column 18 to the blue ground line. This ties light 7 to the shared ground.

    Tip: Column 18 to the blue ground line. This ties light 7 to the shared ground.

  21. 21

    Connect Breadboard (bb1) 19b.j to Breadboard (bb1) bn.19

    Column 19 to the blue ground line. This ties light 8 to the shared ground.

    Tip: Column 19 to the blue ground line. This ties light 8 to the shared ground.

  22. 22

    Connect Breadboard (bb1) 20b.j to Breadboard (bb1) bn.20

    Column 20 to the blue ground line. This ties light 9 to the shared ground.

    Tip: Column 20 to the blue ground line. This ties light 9 to the shared ground.

  23. 23

    Connect Breadboard (bb1) 21b.j to Breadboard (bb1) bn.21

    Column 21 to the blue ground line. This ties light 10 to the shared ground.

    Tip: Column 21 to the blue ground line. This ties light 10 to the shared ground.

  24. 24

    Connect Breadboard (bb1) bn.24 to Arduino GND

    Blue ground line to Arduino ground. One wire grounds every light.

    Tip: Blue ground line to Arduino ground. One wire grounds every light.

    The blue line is connected to Arduino ground.

Try it

  • Press the green Run button — watch the full show: fill up, hold, empty, flash, rest.
  • Try to guess which part comes next!

Peek at code

The all-on and all-off helpers

void allOff() {
  for (int i = 0; i < NUM_LEDS; i++) {
    digitalWrite(FIRST_PIN + i, LOW);
  }
}
void allOn() {
  for (int i = 0; i < NUM_LEDS; i++) {
    digitalWrite(FIRST_PIN + i, HIGH);
  }
}

allOff() and allOn() use loops to switch all ten lights at once, so we don't write ten lines by hand.

Get all the lights ready

void setup() {
  for (int i = 0; i < NUM_LEDS; i++) {
    pinMode(FIRST_PIN + i, OUTPUT);
  }
}

setup() gets every light pin ready, one after another, so they can all glow.

The whole show

void loop() {
  for (int i = 0; i < NUM_LEDS; i++) {
    digitalWrite(FIRST_PIN + i, HIGH);
    delay(80);
  }
  delay(500);
  for (int i = NUM_LEDS - 1; i >= 0; i--) {
    digitalWrite(FIRST_PIN + i, LOW);
    delay(80);
  }
  delay(300);
  for (int n = 0; n < 3; n++) {
    allOn();
    delay(150);
    allOff();
    delay(150);
  }
  delay(800);
}

loop() plays the show in order: fill up, hold, empty out, flash three times, then rest.

Show full sketch (mini-light-show.ino)
const int FIRST_PIN = 2;
const int NUM_LEDS = 10;
void allOff() {
  for (int i = 0; i < NUM_LEDS; i++) {
    digitalWrite(FIRST_PIN + i, LOW);
  }
}
void allOn() {
  for (int i = 0; i < NUM_LEDS; i++) {
    digitalWrite(FIRST_PIN + i, HIGH);
  }
}
void setup() {
  for (int i = 0; i < NUM_LEDS; i++) {
    pinMode(FIRST_PIN + i, OUTPUT);
  }
}
void loop() {
  for (int i = 0; i < NUM_LEDS; i++) {
    digitalWrite(FIRST_PIN + i, HIGH);
    delay(80);
  }
  delay(500);
  for (int i = NUM_LEDS - 1; i >= 0; i--) {
    digitalWrite(FIRST_PIN + i, LOW);
    delay(80);
  }
  delay(300);
  for (int n = 0; n < 3; n++) {
    allOn();
    delay(150);
    allOff();
    delay(150);
  }
  delay(800);
}

Quick quiz

Q1. Which part runs again and again?

  • A. loop() ✓
  • B. setup()
  • C. pinMode only
Why: Yes! loop() runs again and again, forever.

Q2. What makes this a light show?

  • A. Several timed parts that play in order ✓
  • B. Just one wait
  • C. No lights at all
Why: Yes! Putting fun parts in order with waits makes the whole show.

Code lab — try on your own

  1. Speed up the wave — change delay(80) to delay(40) in both wave parts.

    Hint: These are the delay lines inside the loops that light the lights one by one.

  2. Add one more flash — change the flash count from n < 3 to n < 4.

    Hint: Find for (int n = 0; n < 3; n++).

Code walkthrough

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 fills up, empties out, and flashes — a real light show!

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;
void allOff() {
  for (int i = 0; i < NUM_LEDS; i++) {
    digitalWrite(FIRST_PIN + i, LOW);
  }
}
void allOn() {
  for (int i = 0; i < NUM_LEDS; i++) {
    digitalWrite(FIRST_PIN + i, HIGH);
  }
}

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 whole light show plays from start to finish.

Why here

Things that repeat go inside loop().

void loop() {
  for (int i = 0; i < NUM_LEDS; i++) {
    digitalWrite(FIRST_PIN + i, HIGH);
    delay(80);
  }
  delay(500);
  for (int i = NUM_LEDS - 1; i >= 0; i--) {
    digitalWrite(FIRST_PIN + i, LOW);
    delay(80);
  }
  delay(300);
  for (int n = 0; n < 3; n++) {
    allOn();
    delay(150);
    allOff();
    delay(150);
  }
  delay(800);
}

Try this: Change a delay number inside loop(), then press Run to make the show faster or slower.

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

ON lights up a light, OFF turns it dark. Here it turns one light off.

Why here

It goes in loop() so the lights can keep changing.

    digitalWrite(FIRST_PIN + i, LOW);

delay

Big idea

delay means wait. Nothing else happens while it waits.

In this project

It sets how fast each part of the show plays.

Why here

Right after a light turns on or off.

    delay(80);