StarterBeginnerv1.0.0

Running Lights

This project creates a sequence where multiple LEDs turn on and off introducing you to how circuits can control patterns and timing, making LEDs appear to "chase” each other.

2026-04-095 min read
TimingLED PatternsInputs & Outputs#UNDA.Xplora

Introduction

I bet we all love holidays. Christmas is my favorite holiday of the year. We love Christmas because we get to travel to our hometowns, spend time with loved ones and eat lots of delicious foods…..but what I like about Christmas is the decorations; the colorful ribbons, flowers, balloons and my favorite… the Christmas running lights.

With these lights put up in our homes, shops, supermarkets, malls and public places, they are very eye catching and mind blowing as they run around in different patterns.

Christmas running lights also known as LED chasers are built in such a way that multiple LEDs flash on and off for a period of time, forming different patterns such as scrolling, dimming and when looked carefully, they look like they are chasing each other in one direction.

Running Lights Circuit on Xplora 3D Simulator

Things to Learn

In this lesson you will learn :

  • Digital Loops

  • Connecting Multiple LEDs

  • Digital control

Digital Loops

What is a loop?

A loop, just like the name suggests is an instruction that repeats again and again. Unlike human beings, a computer never gets tired or bored and can keep doing a certain task no matter how many times you tell it.

When you need to repeat the same instruction over and over again, we use a loop. A loop can repeat an instruction for a number of times or until a certain condition is met.

description

In Flashing Light Project, we learnt that a computer sends digital instructions of 1’s and 0’s; that is ON and OFF.

Hence, a digital loop is an ON(1) and OFF(0) instruction that repeats again and again. In our running lights project, the LEDs will turn on and off and repeat again and again.

description

Connecting Multiple LEDs

In the first project, we connected a single LED through a battery and a resistor

For multiple LEDs, the circuit is a bit different but the same rules apply. To connect our multiple LEDs, we connect each LED to a battery power supply through a resistor as in the diagram below.

description

To switch the multiple LEDs ON and OFF repeatedly, we connect the LEDs to multiple digital pins on the UNDA.Xplora to send on and off instructions.

description

Digital Control

In this project, UNDA.Xplora acts like a 'tiny boss' that tells each LED what to do. It sends simple instructions-like “turn ON” or “turn OFF”-to each LED one at a time.

The LEDs light up one after another in a sequence; Red, Yellow, Blue, Orange, then Green. Each LED turns on, waits for a moment, then turns off before the next one lights up. Once the Green LED turns off, the pattern repeats again from the Red LED, creating a running lights effect.

Check out this sample Code for Running Lights project using UNDA.Atlas:

Running Lights
UNDA.Atlas
1repeat 3 times:
2  undaPlay LED white ON
3  wait 0.5 seconds
4  undaPlay LED white OFF
5  
6  undaPlay LED green ON
7  wait 0.5 seconds
8  undaPlay LED green OFF
9  
10  undaPlay LED Blue ON
11  wait 0.5 seconds
12  undaPlay LED Blue OFF
13  
14  undaPlay LED Yellow ON
15  wait 0.5 seconds
16  undaPlay LED Yellow OFF
17  
18  undaPlay LED red ON
19  wait 0.5 seconds
20  undaPlay LED red OFF
21    
22
23// Multiple LEDs on
24undaPlay LED white OFF
25undaPlay LED red OFF
26undaPlay LED green OFF
LED Pattern Test

Try to run the code on Unda:Atlas and observe what happens when you open the UNDA.Play Simulator within the application.

UNDA.Xplora Digital Output

Before we build the project, its important to know the digital pins for each LED. We will use digital output pins 3, 5, 6, 10 and 11. These pins will each send a 1 or 0 to the LEDs connected to them.

  • Pin D3 will send ON and OFF to Green LED.
  • Pin D5 will send ON and OFF to Orange LED.
  • Pin D6 will send ON and OFF to Blue LED.
  • Pin D10 will send ON and OFF to Yellow LED.
  • Pin D11 will send ON and OFF to Red LED.

Build the Project

In this section we are going to build the Running Lights Circuit on the UNDA.Xplora breadboard.

Components Used

#NameComponentQtyDescription
1LED
LED
5

Blue,Red,Yellow,Orange,Green Colored LEDs

2Resistor
Resistor
5

220 Ohm Resistor

3Jumper Wire
Jumper Wire
6

Male-Male Jumper Wires

4Battery Connector
Battery Connector
1

9V Battery Connector

5Battery
Battery
1

UNDA 9V Rechargeable Battery

6UNDA:Xplora
UNDA:Xplora
1

Xplora Electronics Kit

Step 1

A preview of how to wire the Green LED on the Breadboard.

Wiring Connections3 connections
FromWire / PartToNote
Xplora Pin A2
green
Breadboard Pin h28Signal Jumper Wire
Breadboard Pin d28Resistor 220 OhmsBreadboard Pin f28Through-Hole Current resistor
Breadboard a28Green LEDBreadboard Bottom GNDConnecting LED Negative to GND
Product image
1
2
3
1
Green LED Connection

Insert a Green LED with the short leg (–) in the bottom negative rail and the long leg (+) in pin a28, as shown.

2
Resistor Connection

Insert the 220 ohm resistor with one leg in d28 (next to the LED's positive leg) and the other in f28, as shown.

3
Signal Wire Connection

Connect a jumper wire from breadboard pin h28 to digital pin B0 on the UNDA.Xplora board.

Step 2

A preview of how to wire the Orange LED on the Breadboard.

Wiring Connections3 connections
FromWire / PartToNote
Xplora Pin BO
orange
Breadboard Pin h21Signal Jumper Wire
Breadboard Pin d21Resistor 220 OhmsBreadboard Pin f21Through-Hole Resistor Current resistor
Breadboard a21Orange LEDBreadboard Bottom GNDConnecting LED Negative to GND
Product image
1
2
3
1
Orange LED Connection

Insert an Orange LED with the short leg (–) in the bottom negative rail and the long leg (+) in pin a21, as shown.

2
Resistor Connection

Insert the 220 ohm resistor with one leg in d21 (next to the LED's positive leg) and the other in f21, as shown.

3
Signal Wire Connection

Connect a jumper wire from breadboard pin h21 to digital pin B0 on the UNDA.Xplora board.

Step 3

A preview of the wiring of the Blue LED on the Breadboard.

Wiring Connections3 connections
FromWire / PartToNote
Xplora Pin B14
red
Breadboard Pin h15Signal Jumper Wire
Breadboard Pin d15Resistor 220 OhmsBreadboard Pin f15Through-Hole Current resistor
Breadboard a15Blue LEDBreadboard Bottom GNDConnecting LED Negative to GND
Product image
1
2
3
1
Red LED Connection

Insert the Red LED with the short leg (–) in the bottom negative rail and the long leg (+) in pin a15, as shown.

2
Resistor Connection

Insert the 220 ohm resistor with one leg in d15 (next to the LED's positive leg) and the other in f15, as shown.

3
Signal Wire Connection

Connect a jumper wire from breadboard pin h15 to digital pin B14 on the UNDA.Xplora board.

Step 4

A preview of the wiring of the Yellow LED on the Breadboard.

Wiring Connections3 connections
FromWire / PartToNote
Xplora Pin B7
yellow
Breadboard Pin h9Signal Jumper Wire
Breadboard Pin d9Resistor 220 OhmsBreadboard Pin f9Through-Hole Current resistor
Breadboard a9Yellow LEDBreadboard Bottom GNDConnecting LED Negative to GND
Product image
1
2
3
1
Yellow LED Connection

Insert the Yellow LED with the short leg (–) in the bottom negative rail and the long leg (+) in pin a9, as shown.

2
Resistor Connection

Insert the 220 ohm resistor with one leg in d9 (next to the LED's positive leg) and the other in f9, as shown.

3
Signal Wire Connection

Connect a jumper wire from breadboard pin h9 to digital pin B7 on the UNDA.Xplora board.

Step 5

A preview of the wiring of the Red LED on the Breadboard.

Wiring Connections3 connections
FromWire / PartToNote
Xplora Pin B3
red
Breadboard Pin h3Signal Jumper Wire
Breadboard Pin d3Resistor 220 OhmsBreadboard Pin f3Through-Hole Current resistor
Breadboard a3Red LEDBreadboard Bottom GNDConnecting LED Negative to GND
Product image
1
2
3
1
Blue LED Connection

Insert an Blue LED with the short leg (–) in the bottom negative rail and the long leg (+) in pin a3, as shown.

2
Resistor Connection

Insert the 220 ohm resistor with one leg in d3 (next to the LED's positive leg) and the other in f3, as shown.

3
Signal Wire Connection

Connect a jumper wire from breadboard pin h3 to digital pin B3 on the UNDA.Xplora board.

Step 6

A preview of connecting the circuit to Ground (GND)

Wiring Connections1 connection
FromWire / PartToNote
Breadboard Bottom Negative Rail
black
Xplora GND PinConnects the entire circuit to Ground
Product image
1
1
Circuit GND Connection

Connect one pin of the jumper from GND pin of the kit and then connect the other pin to any hole of the bottom breadboard negative rail.

Xplora Virtual Simulator

Explore the project in 3D using the interactive virtual UNDA.Xplora kit:
Running Lights

Running the Project

Once you are done building the project, connect the battery to the the battery connector and then plug it to the power port of your UNDA.Xplora to power it on. Remember you can also use a USB-C Cable to power up your kit.

Once your kit is powered on, upload the Running Lights Project and open the Play Section. Try put the different options on the Play Section and observe what happens.

How to Upload the Project

To learn how to upload your project refer to Xplora Menu - Projects.

Observation

Once the project has uploaded and running you will observe that the LEDs light up one after another starting with Green, Orange, Blue, yellow and Red for a period of time and the cycle repeats itself giving the running light appearance. The LEDs will flash repeatedly as long as the power is on.

WARNING

If the LED does not flash, make sure you have connected the circuit correctly.

When you try out the patterns in the Play Section, you will notice that the LEDs are blinking at different patterns and times.

What makes us achieve the different patterns?

The different patterns happen because each pattern has different digital instructions sent from UNDA.Xplora.

  • In Flow Pattern, the delays are very short, so the LEDs turn on and off quickly.
  • In Merge, some LEDs turn on at the same time, making it look like the lights meet in the middle.
  • In Bounce, the first LED blinks for a little while before the next LED starts, making the lights seem like they are bouncing across the board.

By changing the delays in the digital instruction, your Xplora Kit instructs each LED exactly when to turn on and off, creating these fun running light effects!