Starting Electronics needs your help! Please make a donation to help cover our hosting and other costs. Click the donate button to send a donation of any amount.

What is an LED Light Bar?

Created on: 21 September 2012

An LED light bar is a set of LEDs housed in a single package. In the video below a square LED light bar that contains four LEDs is shown.

Can't see the video? View on YouTube →

LED light bars come in different sizes and may be square or rectangular. The longer rectangular light bars may have many more than four LEDs in the package. The LED light bar in the video is made by Kingbright and has the part number: KB-2855SGD (RS Components stock number: 247-2205).

The light bar shown has eight pins that are numbered the same way that a DIP IC package is numbered. The eight pins are for the anode and cathode of each LED.

Driving the LED Light Bar Display

In the video an Arduino Uno is used to drive the LED light bar for demonstration purposes. The Arduino sketch switches all four LEDs on and off simultaneously four times. Each LED is then switched on in sequence four times. The program then repeats.

This is the listing of the Arduino sketch used in the demo:

  Program:      LED_light_bar_drv

  Description:  LED light bar driver - drives the LEDs of a
                four LED light bar.
                This program flashes all four light bar LEDs
                on and off four times and then switches each
                LED on in sequence four times.
  Hardware:     LED light bar from Kingbright, part number:
                KB-2855SGD or similar. The LEDs are
                connected to Arduino pins 2 to 5 via 220 ohm
  Date:         21 September 2012
  Author:       W.A. Smith,
void setup()
    // using pins 2 to 5 as outputs to drive LEDs
    pinMode(2, OUTPUT);
    pinMode(3, OUTPUT);
    pinMode(4, OUTPUT);
    pinMode(5, OUTPUT);

void loop()
    int j, k;
    // flash all LEDs on and off four times
    for (j = 0; j < 4; j++) {
        // switch all LEDs on
        // switch all LEDs off
    // switch only one LED on in sequence, four times
    for (j = 0; j < 4; j++) {
        k = 0;
        do {
            // switch all LEDs off
            digitalWrite(k + 2, HIGH);
        } while (k < 4);

// function to switch all LEDs on or off
// state can be: LOW  - switch all LEDs off
//               HIGH - switch all LEDs on
void AllLEDState(int state)
    int i;
    for (i = 0; i < 4; i++) {
        digitalWrite(i + 2, state);

Books that may interest you:

C Programming with Arduino Book Ultimate Arduino MEGA 2560 Hardware Manual Ultimage Arduino Uno Hardware Manual