Sequencing 7 red LEDs

Good afternoon all! I’m new to all of this.

I’ve run through the lessons in a kit I have been given and come across a project I require help with. I’m trying to make a relatively high end belt gizmo prop from ghostbusters. I have 7 LEDs inside 3D printed Nixi tubes and would like them to turn on in sequence. Either one at a time in sequence along the gizmo, or all turn on in sequence (one lights, then the next, then the next etc) in a quick sequence until all lit and then go off and cycle through.

I can’t seem to find out how to wire and program such a thing. Any ideas?

Thanks to all!

You should get into the habit of giving more details, diagrams and links. This helps others understand what you want to do.

For example, you mention 7 LEDs without describing what type of led. But your photo shows an RGB led, which is, in reality, 3 LEDs.

You mention switching them on and off, but if this is all you wish to do, why use RGB LEDs?

If you do want to use RGB LEDs, then you may need 3 PWM capable Arduino pins to set the colour & brightness. Uno does not have enough of these for 7 RGB LEDs. If this is what you want, I would recommend to use individually addressable LEDs like ws2811/2 or apa106.

Thank you and apologies.

The image was to show the belt gizmo and empty nixi tubes to the right. The left hand project is unrelated and is what I was messing with last night. The original post is what I need help with. Red LEDs, not RGBs. Lighting up in sequence 1 to 7 inside the tubes. Then once all on, switching off then repeating.

Thanks for the advice so far.

1 Like

can you specify the model # of the device your interested in controlling, the one with the LEDs?

does it have a processor, or do you use the board on the left? (model #)

No problem. Currently the board is an Elegoo uno R3 from a kit I was given. The rest isn’t a device yet. I will happily spend some money if I need other parts.

I’m looking to wire the red LEDs myself if necessary into the clear plastic tubes on the fake board to the right…

1 Like

seems like you're really starting from scratch. suggest you google for arduino led sequencer.

the web pages should describe the basics of LED and how they need to be wired as well as some example programming

this forum is really for questions about coding

I very much am. Brave new world for an old hat.

Thank you sir!

You are not alone. There are a lot of OM here.

From one OM to another

2 Likes

have a look at my sketch

https://werner.rothschopf.net/microcontroller/202109_millis_led_sequence_en.htm

basically you just setup the sequence as single bit pattern and let the Arduino run one bit pattern after another.

I looked at @noiasca's link and saw there was a Larson Scanner too.

I spent eleven minutes and wired it up it using the wokwi simulator, a great way to develop projects without spending any money. Also it lets you worry mostly about the software - no broken parts, nothing to burn out or destroy, no loose wires, no dodgy power supply issues.


Try the Larson Scanner here:

Wokwi_badge @noiasca Larson Scanner

// https://forum.arduino.cc/t/sequencing-7-red-leds/1198584
// https://wokwi.com/projects/383651205978330113

/*
  Fun with millis()

  A simple solution for a Larson Scanner
  KITT

*/

const int ledPin[] = {2, 3, 4, 5, 6, 7, 8}; // the number of the LED pins
byte ledState = 0;                          // ledState used to set active LED
char direction = 'U';                       // Up or Down
unsigned long previousMillis = 0;           // will store last time LED was updated
const long interval = 500;                  // interval at which to blink (milliseconds)
const size_t noOfLeds = sizeof(ledPin) / sizeof(ledPin[0]); // calculate the number of LEDs in the array

void setup() {
  for (size_t i = 0; i < noOfLeds; i++)
  {
    pinMode(ledPin[i], OUTPUT);
  }
}

void loop() {
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    digitalWrite(ledPin[ledState], LOW); // switch off "old" LED
    if (direction == 'U') {
      if (ledState < noOfLeds - 1) {     // we can increase
        ledState++;
      }
      else {
        ledState--;                      // we have to decrease
        direction = 'D';                 // and turn direction
      }
    }
    else {                               // this is an implicit direction == 'D' 
      if (ledState > 0) {                // we can decrease
        ledState--;
      }
      else {
        ledState++;                      // we must increase
        direction = 'U';                 // and turn direction
      }
    }
    digitalWrite(ledPin[ledState], HIGH); 
  }
}

HTH

a7

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.