I found following and want to modify it to handle 6+ ledpins.
> /*
> Advanced Blink Sketch
> By: David M. Orlo
> www.DaviedOrlo.com
> */
> byte SWITCHPIN= 2; //Set Pin 2 as Switch
> byte LEDPIN = 6; //Set Pin 6 as LED
> byte brightness; //Create a Integer variable named brightness
> byte delayedoff; //Create a Integer variable named delayedoff
> byte delayedon; //Create a Integer variable named delayedon
> //If you want to go higher than 255 you must change from "byte" to "int"
> boolean buttonstate; //Create a Integer variable named buttonstate
>
> void setup()
> {
> pinMode(SWITCHPIN, INPUT); //Set Pin 2 as Input
> pinMode(LEDPIN, OUTPUT); //Set Pin 6 as Output
> }
>
> void loop()
> {
> buttonstate = digitalRead(SWITCHPIN); //Continually look at the switch to see if its pressed
> if (buttonstate == HIGH) //If the switch goes HIGH, act on it
> {
> crazyLED(); //Now we go into a new function called crazyLED
> }
> }
>
> void crazyLED()//crazyLED function we created and called whatever we want
> {
> buttonstate = LOW; //First we tell the micro the switch is now LOW
> delay(250);
> while (buttonstate == LOW) //White the switch is NOT pressed we do the following
> {
> buttonstate = digitalRead(SWITCHPIN); //Continually look at the switch to see if its pressed
> brightness = random(1, 254); //Generates a random number from 1-254 and assigns it to the variable named brightness
> delayedoff = random(1, 125); //Generates a random delay and assigns it to the variable named delayed
> delayedon = random(1, 250); //Generates a random delay and assigns it to the variable named delayed
> analogWrite(LEDPIN, brightness); //Uses the random number we generated to write the value to our LED
> delay(delayedon); //random delay on time
> analogWrite(LEDPIN, 0); //We turn the LED off for a blinking effect
> delay(delayedoff); //Random delay off time
> }
> //Once the switch is pressed again we break out of the loop above and then break out of the function completely and go back to our main loop
> buttonstate = LOW; //First we tell the micro the switch is now LOW
> analogWrite(LEDPIN, 0); //We turn the LED off before leaving our custom function
> delay(500);
> }
Thank you very much for any help you can give.