ericBcreator
Published © GPL3+

Add Animated (Marquee) Lighting to Your Projects

A simple project to add animated (marquee) lighting to your arcade cabinet or other project with an Arduino Nano and NeoPixels.

BeginnerFull instructions provided1 hour5,577
Add Animated (Marquee) Lighting to Your Projects

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
NeoPixel strip
NeoPixel strip
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Neopixel marquee schematic

Code

Animated marquee light code

Arduino
/*
**********************************************************************
* Marquee lighting with Neopixels by ericBcreator
* simple script for lighting an (arcade) marquee
**********************************************************************
* last update 20181021 by ericBcreator
*
* Inspired by an article by sandyjmacdonald
* https://sandyjmacdonald.github.io/2015/12/02/picade-errata/
* 
* components: 
* - Neopixel strip
* - Arduino Nano
*
* This code is free for personal use, not for commercial purposes.
* Please leave this header intact.
*
* contact: ericBcreator@gmail.com
**********************************************************************
*/

//
// include the libraries
// 

#include <Adafruit_NeoPixel.h>

#define PIN 2																	// define the pin the strip is connected to

//
// setup variables and initialize the neopixel strip
// 

int numOfLeds = 11;														// the numbers of leds on the strip
int minBrightness = 80;												// the minimum brightness of the pulsing and flashing (0-255)
int maxBrightness = 255;											// the maximum brightness of the pulsing and flashing (0-255)
int walkingLedsDelay = 250;										// the delay in ms for the walking leds
int flashDelay = 250;													// the delay in ms for the flashing leds
int numOfFlashLoops = 3;											// the number of times the leds flash
int numOfPulseLoops = 10;											// the number of times the leds puls from min to max
int pulseDelay = 20;													// the delay in ms when pulsing from min to max and vice verse

Adafruit_NeoPixel strip = Adafruit_NeoPixel(numOfLeds, PIN);

//
// setup
// 

void setup() {
  strip.begin();
}

//
// main loop
// 

void loop() {
  walkingLeds();															// show the walking leds
  flashLeds();																// flash the leds
  
  for (int i = 0; i < numOfPulseLoops; i++)		// puls the leds
    pulseBrightness();
}

//
// functions
// 

void walkingLeds() {
  setLedColorsToZero();
  strip.setBrightness(maxBrightness);
  strip.show();
 
  for (int x = numOfLeds; x > 0; x--) {
    strip.setPixelColor(x, strip.Color(255, 255, 255));
    strip.show();
    delay(walkingLedsDelay );
    strip.setPixelColor(x, 0);
    strip.show();
  }  
}

void flashLeds() {
  setLedColors();

  for (int i = 0; i < numOfFlashLoops; i++) {
    strip.setBrightness(maxBrightness);
    strip.show();
    delay(flashDelay );

    strip.setBrightness(minBrightness);
    strip.show();
    delay(flashDelay );
  }
}

void pulseBrightness() {
  setLedColors();

  for (int i = minBrightness; i < maxBrightness; i++) {
    strip.setBrightness(i);
    strip.show();
    delay(pulseDelay);
  }

  for (int i = maxBrightness; i > minBrightness; i--) {
    strip.setBrightness(i);
    strip.show();
    delay(pulseDelay);
  }
}

void setLedColors() {
  for (int x = 0; x < numOfLeds; x++)
    strip.setPixelColor(x, strip.Color(255, 255, 255));
}

void setLedColorsToZero() {
  for (int x = 0; x < numOfLeds; x++)
    strip.setPixelColor(x, strip.Color(0, 0, 0));
}

Credits

ericBcreator

ericBcreator

9 projects • 220 followers

Comments