# Feasibility question

I just came across this site and the Arduino device. Sounds like it might be the perfect answer to what u have been looking for for a long time

My question is this:

I have a project that's requires 9 white LEDs to illuminate. The design criteria is this:

All nine light up simultaneously. All nine go out Each of the nine then illuminate in random fashion ( no specific sequence) After the random sequence, all nine illuminate simultaneously and then go out. The sequence repeats.

If the next sequence woul not match the first sequence, that woul be even better

Is this possible to achieve with this device? Note that I am a complete novice ate programming; this is why I am asking if it is even possible.

Thanks in advance. I would appreciate any input I can get. Thanks again.

Yes that is possible. I would start by learning the Blink Without Delay example. http://arduino.cc/en/Tutorial/BlinkWithoutDelay and learn how to manipulate 1 LED.

Once you have that done try adding another LED.

Since you didn’t specify any time between turning on and turning off I did not put any delays in. This will cause the LEDs turn on and off so frequently they appear a fairly uniform grey. You will have to insert delays if you want to be able to see the actual sequence.

``````// I have a project that's requires 9 white LEDs to illuminate.
const int LEDcount = 9;
const int LEDpins[LEDcount] = {2, 3, 4, 5, 6, 7, 8, 9, 10};  // Data pins connected to white LEDs and current limiting resistors

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

// The design criteria is this:
void loop() {
// All nine light up simultaneously.
for (int i = 0; i < LEDcount; i++)
digitalWrite(LEDpins[i], HIGH);

// All nine go out
for (int i = 0; i < LEDcount; i++)
digitalWrite(LEDpins[i], LOW);

// Each of the nine then illuminate in random fashion ( no specific sequence)
randomSequence();

// After the random sequence, all nine illuminate simultaneously and then go out.
for (int i = 0; i < LEDcount; i++)
digitalWrite(LEDpins[i], HIGH);
for (int i = 0; i < LEDcount; i++)
digitalWrite(LEDpins[i], LOW);

// The sequence repeats.
}

// Each of the nine then illuminate in random fashion ( no specific sequence)
void randomSequence() {
int  sequence[LEDcount];

// Fill the sequence
for (int i = 0; i < LEDcount; i++)
sequence[i] = LEDpins[i];

// Shuffle the sequence by swapping each with a random index
for (int i = 0; i < LEDcount; i++) {
int index = random(LEDcount);  // Pick a number from 0 to LEDcount-1
// Swap the two entries
int temp = sequence[i];
sequence[i] = sequence[index];
sequence[index] = temp;
}

// Light up in random sequence
for (int i = 0; i < LEDcount; i++) {
digitalWrite(sequence[i], HIGH);
}
}
``````

The demo several things at a time is an extended example pf BWoD with 3 LEDS.

...R

Thank you Mr. John for the really quick response.

Apologies for not specifying the delay rates. My bad.

The initial illumination (all nine) should last 5 seconds

All nine going out duration should last 2.5 seconds

The blink of each LED should last 1.5 seconds

After the random sequence, the final re-illumination (all 9) should last 5 seconds

Then repeat

Thanks for your help!!!! I really appreciate it.