Changing from delay() to "without delay()"

@Paul
I have removed a little extra brackets and put in your fix, but it tells me that there are too few arguments??

/*Alittle something for my dad's H0 modeltrain
 *this is the light for a swing from the '50s
 *based on a 8 LED kit from some web retailer.
 *the code is simple, as were the Tivoli light in the '50s
 ************************************************************************/
const int buttonInterval = 100; // number of millisecs between button readings
const int buttonPin = 2;    // the number of the pushbutton pin
//LED Pin Variables
const int ledPins[] = {
  3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; 
//An array to hold the pin each LED is connected to
//i.e. LED #0 is connected to pin 2, LED #1, 3 and so on
//to address an array use ledPins[0] this would equal 2
//and ledPins[9] would equal 11
//Just write in, the pins you use
int buttonState;             // the current reading from the input pin
int lastButtonState = LOW;   // the previous reading from the input pin

int funcCount = 7;           //Here you put how many functions you have                                   
int sequence = 1;            //Here we hold the current sequence in the program
int pinCount = 10;           //Here you type how many LED's you have in your array                         
int Time = 300;              //Here you put how fast the LED's shall shift
// the following variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long lastDebounceTime = 0;  // the last time the output pin was toggled
long debounceDelay = 50;    // the debounce time; increase if the output flickers                                   
unsigned long t;

boolean Next = false;

/***********************************************************************************
 * setup() - this function runs once when you turn your Arduino on
 * We the three control pins to outputs
 ******************************************************************************/
void setup() {
  //Set each pin connected to an LED to output mode (pulling high (on) or low (off)
  int i;
  for( int i=0; i < pinCount; i++){
    pinMode(ledPins[i],OUTPUT); //we use this to set each LED pin to output
  }
    pinMode(buttonPin, INPUT);
}
/****************************************************************************************
 * loop() - this function will start after setup finishes and then repeat
 * we call a function called oneAfterAnother().
 *****************************************************************************************/

void loop() {
  readButton();               // call the functions that do the work
  myDelay();
  if (Next == true)
    if(sequence == funcCount)
    {
      sequence = 1;
    }
    else
    {
      sequence++;
    }

  switch(sequence)
  {
  case 1:
    slowonalloff();
    break;
  case 2:
    oneAfterAnotherLoop();
    break;
  case 3:
    LowToHigh();
    break;
  case 4:
    HighToLow();
    break;
  case 5:
    UpAndDown();
    break;
  case 6:
    SlowOnSlowOff();
    break;
  case 7:
    SlowOnSlowOffReverse();
    break;
  }

}

/******************************************************************
 * Here we start typing in the different types of sequenses we want in
 * our program.
 ******************************************************************/
void myDelay(long t) {
  for (long i = 0; i<= t && digitalRead(buttonPin) == LOW; i++) {
    delay(1);
  }
}
/*************************************************************/
void readButton() {
  // read the state of the switch into a local variable:
  int reading = digitalRead(buttonPin);

  // check to see if you just pressed the button 
  // (i.e. the input went from LOW to HIGH),  and you've waited 
  // long enough since the last press to ignore any noise:  

  // If the switch changed, due to noise or pressing:
  if (reading != lastButtonState) {
    // reset the debouncing timer
    lastDebounceTime = millis();
  } 

  if ((millis() - lastDebounceTime) > debounceDelay) {
    // whatever the reading is at, it's been there for longer
    // than the debounce delay, so take it as the actual current state:

    // if the button state has changed:
    if (reading != buttonState) {
      buttonState = reading;
    }
    if (buttonState == HIGH) {
      Next = true;
    }
  }
}
/******************************************************************************/
void oneAfterAnotherLoop(){
  //Turn Each LED on one after another
  for(int i = 0; i < pinCount; i++){
    digitalWrite(ledPins[i], HIGH);  //Turns on LED #i each time this runs i
    myDelay(Time);                //gets one added to it so this will repeat 
  }                                  //8 times the first time i will = 0 the final
  //time i will equal 7;
  //Turn Each LED off one after another
  for(int i = pinCount; i > 0; i--){  //same as above but rather than starting at 0 and counting up
    //we start at seven and count down
    digitalWrite(ledPins[i], LOW);  //Turns off LED #i each time this runs i
    myDelay(Time);                //gets one subtracted from it so this will repeat 
  }                                  //8 times the first time i will = 7 the final
  //time it will equal 0
}
/*******************************************************************************************
 */

void slowonalloff(){
  //Turn each LED on one after another
  for(int i = 0; i <pinCount; i++){
    digitalWrite(ledPins[i], HIGH);  
    myDelay(Time);                 
  }                                  

  //Turn all LED off at one
  for(int i = 0; i <pinCount;i++ ){
    digitalWrite(ledPins[i], LOW);        //Turns all LED off at once
  }
    myDelay(Time);
}
/*************************************************************************************/

void LowToHigh(){ //This will run the light from the buttom to the top
  for(int i = 0; i < pinCount; i++) { 
    digitalWrite(ledPins[i], HIGH); //Will turn the LED on
    myDelay(Time);
    digitalWrite(ledPins[i], LOW); //Now we turn it off

  }
}

/**********************************************************************************/
void HighToLow(){ //This runs the light from the top to the buttom
  for(int i=pinCount - 1; i >=0; i--) { 
    digitalWrite(ledPins[i], HIGH); //Turn the LED on
    myDelay(Time); //Wait a little
    digitalWrite(ledPins[i], LOW);//And off again

  }
}
/************************************************************************************/
void UpAndDown(){
  for (int i = 0; i < pinCount; i++) {
    digitalWrite (ledPins[i], HIGH);
    myDelay(Time);
    digitalWrite(ledPins[i],LOW);
  }
  {
    for(int i=pinCount - 1; i >=0; i--) { 
      digitalWrite(ledPins[i], HIGH); //Turn the LED on
      myDelay(Time); //Wait a little
      digitalWrite(ledPins[i], LOW);//And off again
    }
  }
}
/********************************************************************************/
void SlowOnSlowOff(){
  //Turn each LED on one after another
  for(int i = 0; i <pinCount; i++){
    digitalWrite(ledPins[i], HIGH);  
    myDelay(Time);                 
  }                                  

  //Turn each LED off again
  for(int i = 0; i <pinCount;i++ ){
    digitalWrite(ledPins[i], LOW);        //Turns all LED off at once
    myDelay(Time);
  }
}
/*********************************************************************************/
void SlowOnSlowOffReverse(){
  //Turn each LED on one after another
  for(int i = pinCount; i <0; i--){
    digitalWrite(ledPins[i], HIGH);  
    myDelay(Time);                 
  }                                  

  //Turn each LED off again
  for(int i = pinCount; i <0;i-- ){
    digitalWrite(ledPins[i], LOW);        //Turns all LED off at once
    myDelay(Time);
  }
}

I have assinged an unsigned long t; in the global variables, so why is'ent it working?
And I love your "Quick N' Dirty" fix, much easier to get my head around :slight_smile: