Code not working- No Errors

Someone wrote this code for me and it worked great.

const unsigned long lowTime = 750;
const unsigned long highTime = 500;
const unsigned long blinkTime = 1000;

unsigned long chaseTime;
unsigned long lastBlink;

byte chaseLed;

void setup()
{
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  pinMode(A5, OUTPUT);
  pinMode(A8, OUTPUT);
}

void loop() {
  unsigned long topLoop = millis();


  if (chaseLed & 1) {
    if (topLoop  - chaseTime >= highTime)  {
      digitalWrite(A0 + (chaseLed >> 1), LOW);
      if (++chaseLed > 7) {
        chaseLed = 0;
      }
      chaseTime = topLoop;
    }
  } else if (topLoop - chaseTime >= lowTime) {
    digitalWrite(A0 + (chaseLed >> 1), HIGH);
    if (++chaseLed > 7) {
      chaseLed = 0;
    }
    chaseTime = topLoop;
  }

  if (topLoop - lastBlink >= blinkTime) {
    digitalWrite(A5, !digitalRead(A5));
    lastBlink = topLoop;
  }
}

I was trying to add sound (which I abandoned because I was in WAY over my head) and add another LED chaser sequence (running independently). Because of the sound I changed the pins of the first chaser and then added the additional chaser in the code below. However, neither of the chasers seem to work. I thought I had understood the concept of the code but clearly I don't. Could anyone point out how I screwed it up? I could use the pins from the first code but I need to add in an 8 led chaser.

const unsigned long lowTime = 750;
const unsigned long highTime = 500;
const unsigned long blinkTime = 100;
const unsigned long blinkTime2 = 1000;

unsigned long chaseTime;
unsigned long lastBlink;

byte chaseLed;


void setup()
{
  pinMode(A12, OUTPUT);
  pinMode(A13, OUTPUT);
  pinMode(A14, OUTPUT);
  pinMode(A15, OUTPUT);
  pinMode(A9, OUTPUT);
  pinMode(A8, OUTPUT);
  pinMode(A11, OUTPUT);
  pinMode(22, OUTPUT);//Bar Graph Always ON
  pinMode(24, OUTPUT);//Bar Graph Always ON
  pinMode(26, OUTPUT);//Bar Graph Chaser
  pinMode(28, OUTPUT);//Bar Graph Chaser
  pinMode(30, OUTPUT);//Bar Graph Chaser
  pinMode(32, OUTPUT);//Bar Graph Chaser
  pinMode(34, OUTPUT);//Bar Graph Chaser
  pinMode(36, OUTPUT);//Bar Graph Chaser
  pinMode(38, OUTPUT);//Bar Graph Chaser
  pinMode(40, OUTPUT);//Bar Graph Chaser
  pinMode(31, OUTPUT);//Particle Thrower Blue Lights
}

void loop()
{
  
unsigned long topLoop = millis();
  if (chaseLed & 1) {
    if (topLoop  - chaseTime >= highTime)  {
      digitalWrite(A12 + (chaseLed >> 1), LOW);
      if (++chaseLed > 15) {
        chaseLed = 0;
      }
      chaseTime = topLoop;
    }
  } else if (topLoop - chaseTime >= lowTime) {
    digitalWrite(A12 + (chaseLed >> 1), HIGH);
    if (++chaseLed > 15) {
      chaseLed = 0;
    }

    if (chaseLed & 1) {
      if (topLoop  - chaseTime >= highTime)  {
        digitalWrite(26 + (chaseLed >> 1), LOW);
        if (++chaseLed > 40) {
          chaseLed = 0;
        }
        chaseTime = topLoop;
      }
    } else if (topLoop - chaseTime >= lowTime) {
      digitalWrite(26 + (chaseLed >> 1), HIGH);
      if (++chaseLed > 40) {
        chaseLed = 0;
      }
      chaseTime = topLoop;
    }

    if (topLoop - lastBlink >= blinkTime) {
      digitalWrite(A9, !digitalRead(A9));
      lastBlink = topLoop;
    }
  }
  if (topLoop - lastBlink >= blinkTime2) {
    digitalWrite(A11, !digitalRead(A11));
    lastBlink = topLoop;
  }
}

First thing I want to point out is that you really should define all of your variables. When you type "byte chaseLed;" you don't give it a value, so whatever value is in that spot in RAM is what chaseLed will have. So, set it to something first. So, if the random value is 105, then when you get here...

digitalWrite(A12 + (chaseLed >> 1), HIGH);

you will be trying to access a pin that doesn't exist.

Furthermore, you don't define "chaseTime", this number could be very large, which may make it a very long time before you see anything happen. Define it!

Check my comments, there is a problem

  } else if (topLoop - chaseTime >= lowTime) {
    digitalWrite(A12 + (chaseLed >> 1), HIGH);
    if (++chaseLed > 15) {  //chaseLed must be even to get to this point, so that means the highest it can be is 14, which will then turn to 15 right here, it can never reach > 15 because of the code above that sets it back to 0
      chaseLed = 0; //This code will never be executed
    }

    if (chaseLed & 1) {  //This is useless, to get here chaseLed has to be even, then it gets changed to odd, so this will always be true
      if (topLoop  - chaseTime >= highTime)  {  //This is also useless because highTime is less than lowTime and to get here topLoop - chaseTime MUST have been greater than lowTime and therefore greater than highTime
        digitalWrite(26 + (chaseLed >> 1), LOW);
        if (++chaseLed > 40) {  //This will never reach 40, it will be reset when it hits 16 from the code above, near the top of loop
          chaseLed = 0;
        }
        chaseTime = topLoop;
      }
    } else if (topLoop - chaseTime >= lowTime) { //Also useless, you already checked for this before you got here, it will always be true
      digitalWrite(26 + (chaseLed >> 1), HIGH);
      if (++chaseLed > 40) { //Again, this will never happen
        chaseLed = 0;
      }
      chaseTime = topLoop;
    }

Furthermore, I hope you are aware that "A12 + chaseLed >> 1" may cause problems, depending on what value A12 represents, you may be accessing a pin that doesn't exist.

When you type "byte chaseLed;" you don't give it a value, so whatever value is in that spot in RAM is what chaseLed will have.

Not true for global variables. They are set to zero if not initialised explicitly.

And...I'v been lied to my entire life...Thank you UKHeliBob

Ps991:
And…I’v been lied to my entire life

(underline added)

I’ve got a grandbaby coming in October. First thing I’m gonna do is teach that kid some esoteric C programming tricks.

Global and statics are both initialised to zero by crt0, unless explicitly given another value.

ChrisTenone:
(underline added)

I’ve got a grandbaby coming in October. First thing I’m gonna do is teach that kid some esoteric C programming tricks.

I’ll have you know I was taught C while in the womb!

Ps991: First thing I want to point out is that you really should define all of your variables. When you type "byte chaseLed;" you don't give it a value, so whatever value is in that spot in RAM is what chaseLed will have. So, set it to something first. So, if the random value is 105, then when you get here...

digitalWrite(A12 + (chaseLed >> 1), HIGH);

you will be trying to access a pin that doesn't exist.

Furthermore, you don't define "chaseTime", this number could be very large, which may make it a very long time before you see anything happen. Define it!

Check my comments, there is a problem

  } else if (topLoop - chaseTime >= lowTime) {
    digitalWrite(A12 + (chaseLed >> 1), HIGH);
    if (++chaseLed > 15) {  //chaseLed must be even to get to this point, so that means the highest it can be is 14, which will then turn to 15 right here, it can never reach > 15 because of the code above that sets it back to 0
      chaseLed = 0; //This code will never be executed
    }

    if (chaseLed & 1) {  //This is useless, to get here chaseLed has to be even, then it gets changed to odd, so this will always be true       if (topLoop  - chaseTime >= highTime)  {  //This is also useless because highTime is less than lowTime and to get here topLoop - chaseTime MUST have been greater than lowTime and therefore greater than highTime         digitalWrite(26 + (chaseLed >> 1), LOW);         if (++chaseLed > 40) {  //This will never reach 40, it will be reset when it hits 16 from the code above, near the top of loop           chaseLed = 0;         }         chaseTime = topLoop;       }     } else if (topLoop - chaseTime >= lowTime) { //Also useless, you already checked for this before you got here, it will always be true       digitalWrite(26 + (chaseLed >> 1), HIGH);       if (++chaseLed > 40) { //Again, this will never happen         chaseLed = 0;       }       chaseTime = topLoop;     }




Furthermore, I hope you are aware that "A12 + chaseLed >> 1" may cause problems, depending on what value A12 represents, you may be accessing a pin that doesn't exist.

Thx for the comments on my code. I guess I don't know where the number "7" originally came from. I thought it was counting the pin numbers A0, A1, A2 etc and he put 7 to stop it before it got to A8 which is serving a different function. So when I increased the pin numbers I increased the number (++chaseLed > 40)

Does that mean the only error I have is the number 15 and 40 in my code? If so, what should they be. I am trying to learn but am pretty lost and I am trying to finish this project this month for my son so I am jumping in WAY over my head.

I guess I don't know where the number "7" originally came from. I thought it was counting the pin numbers A0, A1, A2 etc and he put 7 to stop it before it got to A8 which is serving a different function.

Your analysis is correct, that was it's purpose.

However, "A12 + (chaseLed >> 1)", because chaseLed can go up to 15, will give you A12 + 15 >> 1, which is A19, the Arduino Mega (which I assume is what you are using) does not have an A19. Keep in mind that A# is just a number given a different name, you can type Serial.print(A5); and you will get a number, it is just easier to read when you see A#.

Furthermore, "26 + (chaseLed >> 1)", because chaseLed can go up to 15, will give you 26 + 15/2, which is 33. You will never reach 40. However, I also see "if (++chaseLed > 40) {" and if you allowed it to go to 40, then you would end up with 26 + 40/2, which is 46.

And I would like to help you with the code, but I'm a little lost as well, what exactly are you trying to make it do. I feel like you are using variables multiple times when you should have 2 variables used for both scenarios. Tell us exactly what you expect it to do, that will help alot.

Do you just want 2 chaser LED trails? I found this, is this what you want, but 2 of them? |500x375

Ps991: Your analysis is correct, that was it's purpose.

However, "A12 + (chaseLed >> 1)", because chaseLed can go up to 15, will give you A12 + 15 >> 1, which is A19, the Arduino Mega (which I assume is what you are using) does not have an A19. Keep in mind that A# is just a number given a different name, you can type Serial.print(A5); and you will get a number, it is just easier to read when you see A#.

Furthermore, "26 + (chaseLed >> 1)", because chaseLed can go up to 15, will give you 26 + 15/2, which is 33. You will never reach 40. However, I also see "if (++chaseLed > 40) {" and if you allowed it to go to 40, then you would end up with 26 + 40/2, which is 46.

And I would like to help you with the code, but I'm a little lost as well, what exactly are you trying to make it do. I feel like you are using variables multiple times when you should have 2 variables used for both scenarios. Tell us exactly what you expect it to do, that will help alot.

I changed the code, but when I saw this response I realize that it still is not correct.

I am trying to accomplish the following:(included the pins my code was supposed to be written for as well, feel free to change them)

1 4 LED Chaser (A0-A3) 1 8 Bar Graph LED Chaser that does this: https://www.youtube.com/watch?v=0JeqAHaNdEU (JUST THE UP AND DOWN PART) 1 Always on operating a relay switch (A8) 1 Blinking light (A5) 1 Always on operating a set of lights (31)

const unsigned long lowTime = 750;
const unsigned long highTime = 500;
const unsigned long blinkTime = 1000;

unsigned long chaseTime;
unsigned long lastBlink;

byte chaseLed;

void setup()
{
  pinMode(A0, OUTPUT);//Chaser
  pinMode(A1, OUTPUT);//Chaser
  pinMode(A2, OUTPUT);//Chaser
  pinMode(A3, OUTPUT);//Chaser
  pinMode(A5, OUTPUT);//Orange Light
  pinMode(A8, OUTPUT);//Relay Switch Always On
  pinMode(22, OUTPUT);//Bar Graph ON
  pinMode(24, OUTPUT);//Bar Graph ON
  pinMode(26, OUTPUT);//Bar Graph Chaser
  pinMode(28, OUTPUT);//Bar Graph Chaser
  pinMode(30, OUTPUT);//Bar Graph Chaser
  pinMode(32, OUTPUT);//Bar Graph Chaser
  pinMode(34, OUTPUT);//Bar Graph Chaser
  pinMode(36, OUTPUT);//Bar Graph Chaser
  pinMode(38, OUTPUT);//Bar Graph Chaser
  pinMode(40, OUTPUT);//Bar Graph Chaser
  pinMode(31, OUTPUT);//Particle Thrower Blue Lights
}

void loop() {
  unsigned long topLoop = millis();


  if (chaseLed & 1) {
    if (topLoop  - chaseTime >= highTime)  {
      digitalWrite(A0 + (chaseLed >> 1), LOW);
      if (++chaseLed > 7) {
        chaseLed = 0;
      }
      chaseTime = topLoop;
    }
  } else if (topLoop - chaseTime >= lowTime) {
    digitalWrite(A0 + (chaseLed >> 1), HIGH);
    if (++chaseLed > 7) {
      chaseLed = 0;
    }
    chaseTime = topLoop;
  }
   if (chaseLed & 1) {
    if (topLoop  - chaseTime >= highTime)  {
      digitalWrite(26 + (chaseLed >> 1), LOW);
      if (++chaseLed > 7) {
        chaseLed = 0;
      }
      chaseTime = topLoop;
    }
  } else if (topLoop - chaseTime >= lowTime) {
    digitalWrite(26 + (chaseLed >> 1), HIGH);
    if (++chaseLed > 7) {
      chaseLed = 0;
    }
    chaseTime = topLoop;
  }

  if (topLoop - lastBlink >= blinkTime) {
    digitalWrite(A5, !digitalRead(A5));
    lastBlink = topLoop;
  }
}

I had planned on adding sounds accompanied by blinking lights when a button was pressed but I abandoned that plan and will be incorporating sound with a separate device.

give this code a try, I didn't test it because I don't have a Mega, but if it doesn't work I will put more effort into it

void setup() {
  //4 LED chaser
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  //Bargraph chaser
  pinMode(22, OUTPUT); //always ON
    digitalWrite(22, HIGH);
  pinMode(24, OUTPUT); //always ON
    digitalWrite(24, HIGH);
  pinMode(26, OUTPUT);
  pinMode(28, OUTPUT);
  pinMode(30, OUTPUT);
  pinMode(32, OUTPUT);
  pinMode(34, OUTPUT);
  pinMode(36, OUTPUT);
  pinMode(38, OUTPUT);
  pinMode(40, OUTPUT);
  //Relay switch
  pinMode(A8, OUTPUT); //always ON
    digitalWrite(A8, HIGH);
  //blinking light
  pinMode(A5, OUTPUT);
  //lights
  pinMode(31, OUTPUT); //always ON
    digitalWrite(31, HIGH);
}

const unsigned long lowTime = 750;
const unsigned long highTime = 500;
const unsigned long blinkTime = 1000;

unsigned long lastActionTime = 0;
unsigned long lastBlinkTime = 0;
byte chaser1CurrentLED = 0; //LEDs
byte chaser2CurrentLED = 0; //bargraph
byte state = LOW;

void loop() {
  unsigned long currentTime = millis();

  //chaser LEDs
  if(state == HIGH) {                            //state is HIGH, time to make it LOW
    if(currentTime - lastActionTime >= highTime) {
      lastActionTime = currentTime;
      state = LOW;                               //update the current state
      
      //chaser 1
      digitalWrite(A0 + chaser1CurrentLED, LOW); //set led off
      chaser1CurrentLED++;                       //move on to the next LED
      if(chaser1CurrentLED >= 4)                 //limit A0-A3
        chaser1CurrentLED = 0;

      //chaser 2
      digitalWrite(26 + chaser2CurrentLED, LOW); //set led off
      chaser2CurrentLED += 2;                    //move on to the next LED (increment by 2s)
      if(chaser2CurrentLED >= 15)                //limit 26-40
        chaser2CurrentLED = 0;
    }
  }
  else if(currentTime - lastActionTime >= lowTime) { //state is LOW, time to make it HIGH
    lastActionTime = currentTime;
    state = HIGH;                                //update the current state
    
    //chaser 1
    digitalWrite(A0 + chaser1CurrentLED, HIGH);  //set led on

    //chaser 2
    digitalWrite(26 + chaser2CurrentLED, HIGH);  //set led on
  }

  //blinking LED
  if(currentTime - lastBlinkTime >= blinkTime) {
    lastBlinkTime = currentTime;
    digitalWrite(A5, !digitalRead(A5));          //invert state
  }
}

Ps991: give this code a try, I didn't test it because I don't have a Mega, but if it doesn't work I will put more effort into it

void setup() {
  //4 LED chaser
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  //Bargraph chaser
  pinMode(22, OUTPUT); //always ON
    digitalWrite(22, HIGH);
  pinMode(24, OUTPUT); //always ON
    digitalWrite(24, HIGH);
  pinMode(26, OUTPUT);
  pinMode(28, OUTPUT);
  pinMode(30, OUTPUT);
  pinMode(32, OUTPUT);
  pinMode(34, OUTPUT);
  pinMode(36, OUTPUT);
  pinMode(38, OUTPUT);
  pinMode(40, OUTPUT);
  //Relay switch
  pinMode(A8, OUTPUT); //always ON
    digitalWrite(A8, HIGH);
  //blinking light
  pinMode(A5, OUTPUT);
  //lights
  pinMode(31, OUTPUT); //always ON
    digitalWrite(31, HIGH);
}

const unsigned long lowTime = 750; const unsigned long highTime = 500; const unsigned long blinkTime = 1000;

unsigned long lastActionTime = 0; unsigned long lastBlinkTime = 0; byte chaser1CurrentLED = 0; //LEDs byte chaser2CurrentLED = 0; //bargraph byte state = LOW;

void loop() {   unsigned long currentTime = millis();

  //chaser LEDs   if(state == HIGH) {                            //state is HIGH, time to make it LOW     if(currentTime - lastActionTime >= highTime) {       lastActionTime = currentTime;       state = LOW;                              //update the current state             //chaser 1       digitalWrite(A0 + chaser1CurrentLED, LOW); //set led off       chaser1CurrentLED++;                      //move on to the next LED       if(chaser1CurrentLED >= 4)                //limit A0-A3         chaser1CurrentLED = 0;

      //chaser 2       digitalWrite(26 + chaser2CurrentLED, LOW); //set led off       chaser2CurrentLED += 2;                    //move on to the next LED (increment by 2s)       if(chaser2CurrentLED >= 15)                //limit 26-40         chaser2CurrentLED = 0;     }   }   else if(currentTime - lastActionTime >= lowTime) { //state is LOW, time to make it HIGH     lastActionTime = currentTime;     state = HIGH;                                //update the current state         //chaser 1     digitalWrite(A0 + chaser1CurrentLED, HIGH);  //set led on

    //chaser 2     digitalWrite(26 + chaser2CurrentLED, HIGH);  //set led on   }

  //blinking LED   if(currentTime - lastBlinkTime >= blinkTime) {     lastBlinkTime = currentTime;     digitalWrite(A5, !digitalRead(A5));          //invert state   } }

Thx, I will give it a try. Did you see the youtube link I added after the fact. I realized that I should have been trying to get a chaser that goes up and then down rather than moving from one to another like the original code.

Oh, okay, I’ll edit it later

EDIT:
Try this for going up and down, again, untested

void setup() {
  //4 LED chaser
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  //Bargraph chaser
  pinMode(22, OUTPUT); //always ON
    digitalWrite(22, HIGH);
  pinMode(24, OUTPUT); //always ON
    digitalWrite(24, HIGH);
  pinMode(26, OUTPUT);
  pinMode(28, OUTPUT);
  pinMode(30, OUTPUT);
  pinMode(32, OUTPUT);
  pinMode(34, OUTPUT);
  pinMode(36, OUTPUT);
  pinMode(38, OUTPUT);
  pinMode(40, OUTPUT);
  //Relay switch
  pinMode(A8, OUTPUT); //always ON
    digitalWrite(A8, HIGH);
  //blinking light
  pinMode(A5, OUTPUT);
  //lights
  pinMode(31, OUTPUT); //always ON
    digitalWrite(31, HIGH);
}

const unsigned long delayTime = 750;
const unsigned long blinkTime = 1000;

unsigned long lastActionTime = 0;
unsigned long lastBlinkTime = 0;
signed char chaser1CurrentLED = 0; //LEDs
signed char chaser2CurrentLED = 0; //bargraph

#define DOWN -1
#define UP 1
byte direction1 = UP;
byte direction2 = UP;

void loop() {
  unsigned long currentTime = millis();

  //chaser LEDs
  if(currentTime - lastActionTime >= delayTime) {
    lastActionTime = currentTime;
    chaser1CurrentLED += direction1;             //move on to the next LED
    chaser2CurrentLED += direction1 << 1;        //move on to the next LED (increment by 2s)

    //chaser 1
    if(direction1 == UP) {                       //direction is UP
      digitalWrite(A0 + chaser1CurrentLED, HIGH);//set led on
      if(chaser1CurrentLED >= 4) {               //limit A0-A3
        direction1 = DOWN;                       //reverse direction
        chaser1CurrentLED--;                     //reduce by 1 b/c it went over A3 by 1
      }
    }
    else {                                       //direction is DOWN
      digitalWrite(A0 + chaser1CurrentLED, LOW); //set led off
      if(chaser1CurrentLED < 0)                  //limit A0-A3
        direction1 = UP;                         //reverse direction
        chaser1CurrentLED++;                     //increase by 1 b/c it went under A0 by 1
    }
    
    //chaser 2
    if(direction2 == UP) {                       //direction is UP
      digitalWrite(26 + chaser2CurrentLED, HIGH);//set led on
      if(chaser2CurrentLED >= 8) {               //limit 0-7, after << 1 then 0-14, 26+14=40
        direction2 = DOWN;                       //reverse direction
        chaser2CurrentLED--;                     //reduce by 1 b/c it went over A3 by 1
      }
    }
    else {                                       //direction is DOWN
      digitalWrite(26 + chaser2CurrentLED, LOW); //set led off
      if(chaser2CurrentLED < 0)                  //limit 0-7, after << 1 then 0-14, 26+14=40
        direction2 = UP;                         //reverse direction
        chaser2CurrentLED++;                     //increase by 1 b/c it went under A0 by 1
    }
  }

  //blinking LED
  if(currentTime - lastBlinkTime >= blinkTime) {
    lastBlinkTime = currentTime;
    digitalWrite(A5, !digitalRead(A5));          //invert state
  }
}

So I tested the code. It works better than anything I could get going. However it looks like everything is backwards (based upon how I have it wired.....not sure why). Pretty much all the LOWs need to be HIGH and vise versa.

I switched it and it seems to be doing exactly as I asked....if you wouldn't mind helping me change it to the way I SHOULD have asked I would really appreciate it. The code with the switched LOWs and HIGHs is below as well as the youtube link. Once again, I don't need the fancy splitting pattern, just the UP/DOWN will be fine. You've already helped me out immensely.

https://www.youtube.com/watch?v=0JeqAHaNdEU (JUST THE UP AND DOWN PART)

void setup() {
  //4 LED chaser
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  //Bargraph chaser
  pinMode(22, OUTPUT); //always ON
    digitalWrite(22, LOW);
  pinMode(24, OUTPUT); //always ON
    digitalWrite(24, LOW);
  pinMode(26, OUTPUT);
  pinMode(28, OUTPUT);
  pinMode(30, OUTPUT);
  pinMode(32, OUTPUT);
  pinMode(34, OUTPUT);
  pinMode(36, OUTPUT);
  pinMode(38, OUTPUT);
  pinMode(40, OUTPUT);
  //Relay switch
  pinMode(A8, OUTPUT); //always ON
    digitalWrite(A8, LOW);
  //blinking light
  pinMode(A5, OUTPUT);
  //lights
  pinMode(31, OUTPUT); //always ON
    digitalWrite(31, LOW);
}

const unsigned long lowTime = 750;
const unsigned long highTime = 500;
const unsigned long blinkTime = 1000;

unsigned long lastActionTime = 0;
unsigned long lastBlinkTime = 0;
byte chaser1CurrentLED = 0; //LEDs
byte chaser2CurrentLED = 0; //bargraph
byte state = LOW;

void loop() {
  unsigned long currentTime = millis();

  //chaser LEDs
  if(state == LOW) {                            //state is HIGH, time to make it LOW
    if(currentTime - lastActionTime >= highTime) {
      lastActionTime = currentTime;
      state = HIGH;                               //update the current state
      
      //chaser 1
      digitalWrite(A0 + chaser1CurrentLED, HIGH); //set led off
      chaser1CurrentLED++;                       //move on to the next LED
      if(chaser1CurrentLED >= 4)                 //limit A0-A3
        chaser1CurrentLED = 0;

      //chaser 2
      digitalWrite(26 + chaser2CurrentLED, HIGH); //set led off
      chaser2CurrentLED += 2;                    //move on to the next LED (increment by 2s)
      if(chaser2CurrentLED >= 15)                //limit 26-40
        chaser2CurrentLED = 0;
    }
  }
  else if(currentTime - lastActionTime >= lowTime) { //state is LOW, time to make it HIGH
    lastActionTime = currentTime;
    state = LOW;                                //update the current state
    
    //chaser 1
    digitalWrite(A0 + chaser1CurrentLED, LOW);  //set led on

    //chaser 2
    digitalWrite(26 + chaser2CurrentLED, LOW);  //set led on
  }

  //blinking LED
  if(currentTime - lastBlinkTime >= blinkTime) {
    lastBlinkTime = currentTime;
    digitalWrite(A5, !digitalRead(A5));          //invert state
  }
}

Check my previous reply, I edited in the UP/DOWN pattern, I did not fix the HIGH LOW switching problem, but you can do that

Ps991: Check my previous reply, I edited in the UP/DOWN pattern, I did not fix the HIGH LOW switching problem, but you can do that

Thx, I missed that you had posted again. Switch the HIGH/LOW and test it out.

EDIT: Not working, while testing with 8/10 pins connected (lack of jumpers)

22 + 24 stay on for awhile (1-2 minutes) but then shut off.

26 + 28 stay off (they work, light up on Arduino startup)

30, 32, + 36 Stay ON.

I made several fixes, found some logic flaws, especially on the end conditions

Give this a go, I tested it out using the Serial Monitor on an UNO and it seems to work as expected

void setup() {
  //4 LED chaser
  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  //Bargraph chaser
  pinMode(22, OUTPUT); //always ON
    digitalWrite(22, HIGH);
  pinMode(24, OUTPUT); //always ON
    digitalWrite(24, HIGH);
  pinMode(26, OUTPUT);
  pinMode(28, OUTPUT);
  pinMode(30, OUTPUT);
  pinMode(32, OUTPUT);
  pinMode(34, OUTPUT);
  pinMode(36, OUTPUT);
  pinMode(38, OUTPUT);
  pinMode(40, OUTPUT);
  //Relay switch
  pinMode(A8, OUTPUT); //always ON
    digitalWrite(A8, HIGH);
  //blinking light
  pinMode(A5, OUTPUT);
  //lights
  pinMode(31, OUTPUT); //always ON
    digitalWrite(31, HIGH);
}

const unsigned long delayTime = 750;
const unsigned long blinkTime = 1000;

unsigned long lastActionTime = 0;
unsigned long lastBlinkTime = 0;
signed char chaser1CurrentLED = 0; //LEDs
signed char chaser2CurrentLED = 0; //bargraph

#define DOWN -1
#define UP 1
signed char direction1 = UP;
signed char direction2 = UP;

void loop() {
  unsigned long currentTime = millis();

  //chaser LEDs
  if(currentTime - lastActionTime >= delayTime) {
    lastActionTime = currentTime;                //update timing

    //normal conditions
    //chaser 1
    if(direction1 == UP) {                       //direction is UP
      digitalWrite(A0 + chaser1CurrentLED, HIGH);//set led on
    }
    else {                                       //direction is DOWN
      digitalWrite(A0 + chaser1CurrentLED, LOW); //set led off
    }
    
    //chaser 2
    if(direction2 == UP) {                       //direction is UP
      digitalWrite(26 + chaser2CurrentLED, HIGH);//set led on
    }
    else {                                       //direction is DOWN
      digitalWrite(26 + chaser2CurrentLED, LOW); //set led off
    }

    //update LEDs
    chaser1CurrentLED += direction1;             //move on to the next LED
    chaser2CurrentLED += direction2 << 1;        //move on to the next LED (increment by 2s)

    //end conditions
    //chaser 1
    if(direction1 == UP) {                       //direction is UP
      if(chaser1CurrentLED >= 4) {               //limit A0-A3
        direction1 = DOWN;                       //reverse direction
        chaser1CurrentLED = 3;                   //move back into range
      }
    }
    else {                                       //direction is DOWN
      if(chaser1CurrentLED < 0) {                //limit A0-A3
        direction1 = UP;                         //reverse direction
        chaser1CurrentLED = 0;                   //move back into range
      }
    }

    //chaser 2
    if(direction2 == UP) {                       //direction is UP
      if(chaser2CurrentLED >= 15) {               //limit 0-7, after << 1 then 0-14, 26+14=40
        direction2 = DOWN;                       //reverse direction
        chaser2CurrentLED = 14;                   //move back into range
      }
    }
    else {                                       //direction is DOWN
      if(chaser2CurrentLED < 0) {                //limit 0-7, after << 1 then 0-14, 26+14=40
        direction2 = UP;                         //reverse direction
        chaser2CurrentLED = 0;                   //move back into range
      }
    }
  }

  //blinking LED
  if(currentTime - lastBlinkTime >= blinkTime) {
    lastBlinkTime = currentTime;
    digitalWrite(A5, !digitalRead(A5));          //invert state
  }
}

Alright, the code you wrote operates the Bar Graph in the EXACT manner I needed (would like to speed up 2-3x). However, it messed up the 4 LED chaser. I substituted that portion of the code with a previous version and now it appears everything is working.

How would I adjust the code below to speed up the Bar Graph portion 2-3x.?

EDIT: Removed an erroneous code.

Reduce your timing constants.

Although, instead of just saying its broken and doesn't work, lets fix the problem. What exactly is wrong with it, because I see nothing wrong with the code and I tested it in the Serial monitor, it should work fine.

If you want to see how it works in Serial Monitor, replace this code:

    //normal conditions
    //chaser 1
    if(direction1 == UP) {                       //direction is UP
      digitalWrite(A0 + chaser1CurrentLED, HIGH);//set led on
    }
    else {                                       //direction is DOWN
      digitalWrite(A0 + chaser1CurrentLED, LOW); //set led off
    }

with this

    //normal conditions
    //chaser 1
    if(direction1 == UP) {                       //direction is UP
      digitalWrite(A0 + chaser1CurrentLED, HIGH);//set led on
      Serial.print(chaser1CurrentLED);
      Serial.println(" ON");
    }
    else {                                       //direction is DOWN
      digitalWrite(A0 + chaser1CurrentLED, LOW); //set led off
      Serial.print(chaser1CurrentLED);
      Serial.println(" OFF");
    }

and add this code to setup()

Serial.begin(9600);