A bullseye light pattern.

I am new to arduino boards but have a decent understanding of electronics. I have made a bullseye style light sequence using a plc but I want to try something newer than a keyence plc.

By bullseye sequence I mean I have 4 rings of leds. When a switch is activated it would start the sequence. So it would go (from the center out) 1-2-3-4 (with each light staying on as the next lights up.) Repeat that pattern once- then flash all 4 ring together for a specified amount of time then turn off until the button is pressed again.

I figure I could just wire each output into a relay to control the led string since the outer rings draw alot of current.

I am not looking for the entire script to be made for me but a first or second step would be very helpful and appreciated.

The addition of a transistor will allow the Arduino to control higher voltage and current loads. You may want to do that instead of using relays because the transistors will allow you to do fading effects. You would probably need transistors to drive the relays anyway since most relays need more than 30 mA at 5V (absolute max for Arduino outputs is 40 mA 5V).

Some of the outputs on an Arduino support Pulse Width Modulation. The 'analogWrite(pin, value)' lets you set the portion of time the pin is HIGH from 0 (off) to 255 (full on). You should connect your LED's to those pins to allow fading effects at a later date. On the UNO the PWM pins are 3, 5, 6, 9, 10, and 11. Pins 10 and 11 are useful for an Ethernet Shield so I would recommend 3, 5, 6, and 9.

const int ringCount = 4;
const int ringPins[ringCount] = {3, 5, 6, 9};

void setup() {
    for (int i=0; i<ringCount; i++)
        pinMode(ringPins[i], OUTPUT);
}

void loo() {
   //  Turn them on one at a time
   for (int i=0; i<ringCount; i++) {
        digitalWrite(ringPins[i], HIGH);
        delay(1000);  // One second delay between rings
    }

   //  Turn them off one at a time
   for (int i=0; i<ringCount; i++) {
        digitalWrite(ringPins[i], LOW);
        delay(1000);  // One second delay between rings
    }

   //  Blink them on and off five times
   for (int count=0; count < 5; count++) {
        for (int i=0; i<ringCount; i++) {
            digitalWrite(ringPins[i], HIGH);
        }
        delay(500);
        for (int i=0; i<ringCount; i++) {
            digitalWrite(ringPins[i], LOW);
        }
        delay(500);
    }
}

I wasn't sure of the arduino current output so thanks for the input about the transistors. Also thank you for the code- I have 2 questions- First, what pin is the input or trigger to start the bullseye sequence? Second where it says "void loo" should that be "loop"?

Again thanks for your help I really appreciate it!

what pin is the input or trigger to start the bullseye sequence?

That part is left as an exercise for the student. :slight_smile:

Second where it says "void loo" should that be "loop"?

Yes! See? You're learning already!

Ah fair enough- I ll see what I can learn. Thanks again for your help!