Making a nested loop repeat before going back to main loop

O wow... Yeah thanks for the key word. That was a HUGE chunk in learning this. Atleast for me. Wow.... I wish I had learned this years ago. I'm going to need some more arduinos LOL.

retrolefty:
That make sense?
Lefty

Perfect. very VERY clear. Your good at dumbing it down hahaha.

So I'm trying to not ask to much of you guys on this one and really want to learn how to code but I just wasted 4 hours of my life. I want this thing to control a lightning storm on my reef tanks leds. So that being said I needed random delays. So I googled around and found how to use an analogRead to make random numbers. Well it was really hard to control so it was about 30 mins making the code correct and then 3.5 hours tweeking it. I came up with this.

void loop() {
  wildcard = (analogRead(5)%30)*2;
  darksky = (analogRead(0)%75)*200;
  lightsky = (analogRead(5)%100)*wildcard; 
  delay(darksky);
  digitalWrite(led, HIGH);   // turn the LED on
  delay(lightsky);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED
  delay(1000);               // wait for a second
}

And man o man was I proud of myself. I was going to come on and ask a question about getting a wider range of numbers so I could have 10mS all the was to 5ish seconds but plowed on ahead anyways.

So then I went on to making the led flicker to look more like lightning and the first thing I see after 10 seconds on google is delay(random(200,1000))

:0 OMG GTFO ROFLCOPPTER BOOM HEADSHOT

I know I will never stop going through this. I mean you all still do every once in awhile right? But this is my first so I feel entitled to the right to make you all read about it.

heres my new one after 10 mins of testing.

void loop() {
  burst = random(10,100);
  big = random(3000,4000);
  delay(1000);
  digitalWrite(led, HIGH);   // turn the LED on
  delay(random(burst, big)); 
  digitalWrite(led, LOW);    // turn the LED off
}

I've been up since 10:00 am yesterday, started learning this stuff at around 10:00 pm and now it 5:30 am. I'm to tired to make them flicker. Maybe the arduino forum fairy will visit my post in my sleep and write the flicker for me ahahaha.