4 rgb leds digital low issue

I have 4 common anode RGB LED's. Each R, G and B pin on the 4 LED's are wired to 3 pwm pins. 3 modes are selected by a button, the syncPin. The code below IS working off a arduino uno.

int redPin = 11; // to red pin on rgb led
int bluePin = 10;   // to blue pin on rgb led
int greenPin = 9;   // to green pin on rgb led
int xButton = 7;     // to x button 
int aButton = 6;     // to a button
int yButton = 5;     // to y button
int bButton = 4;     // to b button
int syncPin = A5;     // to syny button, button which changes modes
int counter;         // used to keep track of the mode
int sensorValue;

void setup()

{
  pinMode(redPin, OUTPUT);     
  pinMode(greenPin, OUTPUT);    
  pinMode(bluePin, OUTPUT);    
  pinMode(yButton, OUTPUT);
  pinMode(aButton, OUTPUT);
  pinMode(bButton, OUTPUT);
  pinMode(xButton, OUTPUT);
  pinMode(syncPin, INPUT);
  int counter = 1;
 
}

void loop()

{
  if (counter == 1)                //mode 1
  
  {
    color(0, 0, 0); 
    digitalWrite(yButton, HIGH);        //all buttons off, no color  (off position)
    digitalWrite(xButton, HIGH);
    digitalWrite(bButton, HIGH);
    digitalWrite(aButton, HIGH);
    delay(1);
  } 
      
if (counter == 2)                    //mode 2
  {
      color(255, 255, 0);                   //set color yellow
      digitalWrite(yButton, HIGH);          //set y button high
      delay(1);                             // emits yellow to y button for one thousandth of second
      digitalWrite(yButton, LOW);           // turn y button off
           
      color(0, 0 , 255 );                   // new color, new button on, new button off ect.
      digitalWrite(xButton, HIGH);
      delay(1);
      digitalWrite(xButton, LOW);
           
      color(255, 0, 0);
      digitalWrite(bButton, HIGH);
      delay(1);
      digitalWrite(bButton, LOW);
           
      color(0, 255, 0);
      digitalWrite(aButton, HIGH);
      delay(1);
      digitalWrite(aButton, LOW);
  } 
      
     if(counter == 3)             //mode 3
  
  {
    
    color(255,255,0);                   //set color YELLOW!

    digitalWrite(yButton, HIGH);    //all buttons on
    digitalWrite(xButton, HIGH);    //
    digitalWrite(bButton, HIGH);    //
    digitalWrite(aButton, HIGH);    //
    delay(1);
  }

    
    int sensorValue = analogRead(syncPin);

    float voltage = sensorValue * (5 / 1023.0); 

     if(analogRead(sensorValue) < 5)
    {
      delay(200);
      counter++;
      delay(200); 
    }



    if(counter > 3)        //if mode is over 3, reset to off or mode 1
    {
     counter = 1;
    }
    
  //end loop
}


void color(unsigned char red, unsigned char green, unsigned char blue)     // the color generating function

{

  analogWrite(bluePin, 255-blue);

  analogWrite(greenPin, 255-green);

  analogWrite(redPin, 255-red);

}

The problem I am having is that this part of the code below(mode 2) is NOT working when wired to an attiny44.

if (counter == 2)                    //mode 2
  {
      color(255, 255, 0);                   //set color yellow
      digitalWrite(yButton, HIGH);          //set y button high
      delay(1);                             // emits yellow to y button for one thousandth of second
      digitalWrite(yButton, LOW);           // turn y button off
           
      color(0, 0 , 255 );                   // new color, new button on, new button off ect.
      digitalWrite(xButton, HIGH);
      delay(1);
      digitalWrite(xButton, LOW);
           
      color(255, 0, 0);
      digitalWrite(bButton, HIGH);
      delay(1);
      digitalWrite(bButton, LOW);
           
      color(0, 255, 0);
      digitalWrite(aButton, HIGH);
      delay(1);
      digitalWrite(aButton, LOW);
  }

The mode 2 is not working. I believe it is not working because at least one digital LOW is given to any of a, b, x or y buttons. So because a digital low is given to to the LED or LED's, the if loop is only run once, and because the loop is only 4 thousandths of second, it is skipped over with a delay equal to the 2 delays here:

   {
      delay(200);
      counter++;
      delay(200); 
    }

Which adds up to 400 thousandths of a second. So, I conclude that the counter is incremented upwards at the end of the if loop for mode 2? So, I do not understand why a digital low is not working with the attiny44 and why the if loop is only run once?

The other modes a working fine, the LED's are lighting up beautifully, I just need help implementing the code with my attiny44.

Thank you.

This part looks wrong:

    int sensorValue = analogRead(syncPin);
     if(analogRead(sensorValue) < 5) {

I believe it's correct. When the sync button is pressed, the voltage drops to nearly zero, giving a value of around 1. Do this part of the code you suggested could be causing the problems?