wireless start light button problem

Hi folks as a beginner I am planning to make a start light simulation by using 3 push buttons and nrf24l01 modules. I am having some issues with the pushbutton code implementation. when the button for red pressed for one time I want it to lit constantly. then I press for green and it should lit the same way. Finally when i push the reset all leds should go off. You can see the diagram and code but code is not working properly.
What could be the problem? Appreciate for any help.

const int  buttonPin_one = 1;    
const int ledPin_one = 13;       
const int buttonPin_two=3;
const int ledPin_two=11;
const int button_reset=5;

 

int buttonPushCounter_one = 0;   
int buttonState_one = 0;         
int lastButtonState_one = 0;     

int buttonPushCounter_two = 0;   
int buttonState_two = 0;         
int lastButtonState_two = 0;

//int buttonPushCounter_three = 0;   
boolean buttonState_three = false;         
boolean lastButtonState_three = false;
int state=0;

void setup() {
 
  pinMode(buttonPin_one, INPUT_PULLUP);
  
  pinMode(ledPin_one, OUTPUT);
 
 pinMode(buttonPin_two,INPUT_PULLUP);

 pinMode(ledPin_two, OUTPUT);
 
 pinMode(button_reset,INPUT);
 
  
}


void loop() 
{
  
  buttonState_one = digitalRead(buttonPin_one);
  buttonState_two = digitalRead(buttonPin_two);
  buttonState_three=digitalRead(button_reset);

///////////////////////////////////////////////////////////////  
  if (buttonState_one != lastButtonState_one) 
  {
    
      if (buttonState_one == HIGH) 
      {
      
           buttonPushCounter_one++;
                      
      } 
         
    delay(20);
  }
  lastButtonState_one = buttonState_one;

              if (buttonPushCounter_one % 2 == 0) 
              {
               digitalWrite(ledPin_one, HIGH);
              } 

////////////////////////////////////////////////////////////////
      if (buttonState_two != lastButtonState_two) 
      {
    
          if (buttonState_two == HIGH) 
          {
      
           buttonPushCounter_two++;
          } 
    
        delay(20);
      }
  
          lastButtonState_two = buttonState_two;


              if (buttonPushCounter_two % 2 == 0) 
              {
               digitalWrite(ledPin_two, HIGH);
              } 
///////////////////////////////////////////////////////////////////
if (buttonState_three != lastButtonState_three) {
    
    if (buttonState_three == HIGH) {

      digitalWrite(ledPin_two, LOW);
     digitalWrite(ledPin_one, LOW);
      
     
    } 
    
    delay(50);
  }
  
  lastButtonState_three = buttonState_three;
  
 

}

traffic_light.ino (2.16 KB)

const int  buttonPin_one = 1;

Your Fritz shows pin 2. FYI pin 1 is the hardware serial TX pin.

pinMode(buttonPin_one, INPUT_PULLUP);

This implies that the button is wired input to ground, so the button state is high when not pushed and low when pushed. Assuming normally open switches. I have to assume cause the Frtz doesn’t say, a schematic would be more clear.

if (buttonState_one == HIGH) 
      {
      
           buttonPushCounter_one++;
                      
      }

And here you increment the counter if the button is not pushed. Is that right?
The same for button 2.

Does the reset button have an external pulldown (or pullup) resistor. I ask cause it has no INPUT_PULLUP.

Common button wiring:

digin.jpg

Please read the “how to use the forum” stickies. They will tell you how to format and post code and hoe to ask an effective question. It is better if you post your code instead of attaching it.

Thanks but I know input pins are different its ok. I tried to use internal pullup resistors. but my main problem which is reset button not working