Larson scanner without delay.

I am relatively new to the arduino language, and I am building a program where when one of the analog inputs sees 5v a non delay based Larson scanner runs. For what ever reason I'm having a mental block. I would love to use the millis function. Any help on a basic sketch would be greatly appreciated.

Standard response on these forums is to link to the BlinkWithoutDelay example. http://arduino.cc/en/Tutorial/BlinkWithoutDelay

Nick Gammon takes it a step further and shows how to use the concept with multiple LEDs. http://www.gammon.com.au/forum/?id=11411

when one of the analog inputs sees 5v a non delay based Larson scanner runs.

You might want to explain what a "Larson scanner" is.

The effect of the “eyes”.
You should really know that stuff ;).

Oh, I thought that was called a "KnightRider" display. (Google/wikipedia teaches me now Larson was the inventor of this effect in - amongst other - Knight Rider. One learns something every day.)

You should really know that stuff

I had assumed that a Larson scanner was something to do with The Far Side.

int ledPins = {2,3,4,5,6,7,8,9};

int len = sizeof(ledPins) / sizeof(int);
int dir = 1;

void setup()
{
for (int thisPin = 0; thisPin < len; thisPin++)pinMode(ledPins[thisPin], OUTPUT);
}

void pulse_width_modulation(int pos)
{
if(dir==1)
{
dir = 0;
for (int led=len; led>0; --led)fadeIn(led);
}else{
dir = 1;
for (int led=0; led<len; ++led)fadeIn(led);
}
}

void fadeIn(int pos)
{
for(int bri = 150; bri < 256; ++bri)
{
if(dir==1 && pos>0)analogWrite(ledPins[pos-1], 255-bri);
if(dir==0 && pos<len)analogWrite(ledPins[pos+1], 255-bri);
analogWrite(ledPins[pos], bri);
delay(1);
}
}

void loop()
{
static uint8_t pos=0;
while(pos<len)
{
pulse_width_modulation(pos);
++pos;
}
while(pos>0)
{
–pos;
pulse_width_modulation(pos);
}
}

this is using arduino mega