button problem (dont know what it is)

So i have a simple circuit (I'm new) and i' making a traffic light system which will turn on when you press a button. But when i press the button i don't think anything happens and pressed or not pressed the lights follow the code after an amount of seconds. The circuit is not the problem and im using 220 resistors and specifically for the button i have used a 10k resistor and a 220 resistor. the arduino is not damaged and im following (kind of) from here

Going Deeper: Arduino Pedestrian Crossing, the circuit looks like this (second image)
(the only difference is that the lights will activate automatically after a fixed amount of seconds (unknown))

int redLED = 10; 
int yellowLED = 9;
int greenLED = 8;
int buttonPIN = 12;
int buttonPINValue = 0;

//runs at start
void setup() {
  pinMode(redLED, OUTPUT);
  pinMode(yellowLED, OUTPUT);
  pinMode(greenLED, OUTPUT);
  pinMode(buttonPIN, INPUT);
 
}

//constantly runs
void loop(){
    allBlink();
     changeLights();
    
}

//cross lights colour
void changeLights(){
   
    digitalWrite(greenLED, LOW);
    digitalWrite(yellowLED, HIGH);
    delay(2000);

  
    digitalWrite(yellowLED, LOW);
    digitalWrite(redLED, HIGH);
    delay(2000);

  
    digitalWrite(yellowLED, HIGH);
    delay(2000);

    
    digitalWrite(yellowLED, LOW);
    digitalWrite(redLED, LOW);
    digitalWrite(greenLED, HIGH);
    delay(2000);
    digitalWrite(greenLED, LOW);
}

//all lights blink before start
void allBlink(){
 
    for (int i = 0; i < 3; i++) {
       digitalWrite(yellowLED, HIGH);
       digitalWrite(redLED, HIGH);
       digitalWrite(greenLED, HIGH);
       delay(100);
   
       digitalWrite(yellowLED, LOW);
       digitalWrite(redLED, LOW);
       digitalWrite(greenLED, LOW);
       delay(100);
    }
}

void buttonPress(){
  buttonPINValue = digitalRead(buttonPIN);
  if(buttonPINValue == HIGH){
    
     allBlink();
     changeLights();
     buttonPINValue = LOW;
  }
}

(thank you in advance)

OK, some first things first.

You need to go and read the forum instructions so that you can go back and modify your original post (not re-post it) - using the "More -> Modify" option below the right hand corner of your post - to mark up your code as such using the "</>" icon in the posting window. Just highlight each section of code (or output if you need to post that) from the IDE and click the icon.

In fact, the IDE itself has a "copy for forum" link to put these markings on a highlighted block for you so you then just paste it here in a posting window. But even before doing that, don't forget to use the "Auto-Format" (Ctrl-T) option first to make it easy to read. If you do not post it as "code" it can easily be quite garbled and is always more difficult to read due to the font.

{It is inappropriate to attach it as a ".ino" file unless it is clearly too long to include in the post proper. People can usually see the mistakes directly and do not want to have to actually load it in their own IDE. And even that would also assume they are using a PC and have the IDE running on that PC.}

Also tidy up your blank space. Do use blank lines, but only single blanks between complete functional blocks.


Right, next bit. Where is the image of your circuit? What is this bit about connecting the button with a 10k resistor and a 220 resistor? Buttons or switches should connect between an Arduino pin and ground and can use a pinMode of INPUT_PULLUP. You may however require a pull-up such as 10k - from the pin to 5 V. The button will read LOW when pressed.

There is no point setting buttonPINValue as LOW if you are going to read the button to it next.

If you correct how you have posted the code, we will take a closer look at it.

oh nevermind but thank you for replying
i have found the problem. Me being forgetful forgot to connect one of the wires to the button, sorry for wasting your time and thank you on telling how to improve my posts