From delay to millis

Hello people there!

I am building a project
with 1 led that can fade, its a simple code.
but i like to made in millis but I dont not how i must start,
I have seen a lot stuff with millis but not compare to this what i want
and if this works, than i update it to 3 and more leds.

So i need some help and advice
How can I do here on this code change the delay to millis?
here is the Code :

int ledPin = 9; 
int randNumber;

void setup() {};

void loop() {
randNumber = random(0, 255);
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { // als het fadevalue kleinder is dan 255, dan zal hij de waarde "fadevalue" verhogen met 5
analogWrite(ledPin, fadeValue); // analoog geschreven(uitgang, met de aangekoppelde fadevalue waarde )
delay(10); // tijds vertraaging van 1Seconde
}

for(int fadeValue = 255 ; fadeValue >= (randNumber); fadeValue -=20) {
analogWrite(ledPin, fadeValue);
delay(100);
}
}

If I am correct, i need some like :
unsigned long currentTime;
unsigned long loopTime;
unsigned long Time_fadeup;
unsigned long Time_fadedown;

but how can I combine this o

void loop(){
currentTime = millis();

if ((currentTime - previousTime1)>=interval1){
previousTime1 = previousTime1 + interval1;
// do time1 action
}
if ((currentTime - previousTime2)>=interval2){
previousTime2 = previousTime2 + interval2;
// do time2 action
}
} // end loop

I'm actually doing a similar project. I have it in Fade now, but want to switch it to millis. One of my "effects" does multiple fades, and switching to millis makes it where the effect can be switched while in the middle of it...You can check out my code in that particular thread here with some other comments: http://arduino.cc/forum/index.php/topic,152978.msg1147533.html#msg1147533

There's an example in the Arduino IDE called BlinkNoDelay. (http://arduino.cc/en/Tutorial/BlinkWithoutDelay)

It is the code given above but explained a bit more.

CrossRoads: void loop(){ currentTime = millis();

if ((currentTime - previousTime1)>=interval1){ previousTime1 = previousTime1 + interval1; // do time1 action } if ((currentTime - previousTime2)>=interval2){ previousTime2 = previousTime2 + interval2; // do time2 action } } // end loop

Am I allowed to whack you upside the head for not putting this in proper code tags? :)

Hey, I was at work, cranked it out quick...

There, how's that?

Or maybe I wasn't - these message time stamps don't seem to make sense.

It dont work… sorry for later posting a reply… time…

oke i have made it like this :

unsigned long previousTime2;
unsigned long interval2 = 100;
unsigned long previousTime1;
unsigned long interval1 = 10;
unsigned long currentTime;

int ledPin = 9;

void setup(){}
void loop(){

currentTime = millis();

if ((currentTime - previousTime1)>=interval1){
previousTime1 = previousTime1 + interval1;
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { // als het fadevalue kleinder is dan 255, dan zal hij de waarde “fadevalue” verhogen met 5
analogWrite(ledPin, fadeValue); // analoog geschreven(uitgang, met de aangekoppelde fadevalue waarde )
////delay(10); // tijds vertraaging van 1Seconde
}
}
if ((currentTime - previousTime2 + interval2)>=interval2){
previousTime2 = previousTime2 + interval2;
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
analogWrite(ledPin, fadeValue);
///delay(100); // tijds vertraaging van 1Seconde
}
}

} // end loop