led does not go on or of

digitalRead(8) == buttonPushCounter ;

What do you imagine that does?

Please talk us through it.

((digitalRead(8) == 3)That is never, ever going to happen.

We've been through this before.

when the button is pushed it ad on counter +1

Please review this:

opelvectra:
when the button is pushed it ad on counter +1

Open the IDE.

Click on. "files", scroll down to "examples".
Start with "01" .

i already did the examples for my test it dont help allot

Maybe try them again.
You missed a lot (note spelling) of the key points.

You need to ‘master’ those examples before you proceed.

ill try i dotn have that much time i have to fill my example code soon

You'd be better ignoring your code, and concentrating on the basics.

opelvectra:
i already did the examples for my test it dont help allot

From the Button example

  buttonState = digitalRead(buttonPin);

From your code

  digitalRead(8) == buttonPushCounter ;

Do you see a difference ?

buttonState = digitalRead(buttonPin);
Pin 8 is high or low state from it

digitalRead(8) ==buttonPushCounter ;

Nothing beacause pin 8 can be just high or low ?

buttonState = digitalRead(buttonPin);
Pin 8 is high or low state from it

No. buttonState will be HIGH or LOW depending on the state read from buttonPin

Nothing beacause pin 8 can be just high or low ?

No. digitalRead() returns a HIGH or LOW value. You cannot change the state of an input pin using digital[u]Read/u The clue is in the name

digitalRead(8) ==buttonPushCounter ;

Is pointless - you're comparing two entities (the return value of digitalRead (8) and the variable buttonPushCounter).

The comparison will be true if they're equal, false if they're not.

But you're not doing anything with that true or false, so all you've done is waste a few microseconds.

Got it read only reads if the. Pon is high or low stil can figuere outhow to put this in a while functie whit if and else its easyer

if (digitalRead(somePin) == LOW)  //execute the code once if true
  {
    //execute this code
  }
while (digitalRead(somePin) == LOW)  //execute code repeatedly until the test is false
  {
    //execute this code
  }

while (digitalRead(somePin) == LOW) //execute code repeatedly until the test is false
{
//execute this code
}

Can while be maked twice for on and off function and do i add a counter in de execute code ?

please review and understand how the following code recognizes a button press and increments a count displayed on the serial interface

const byte ButPin       = 8;

int   buttonPushCounter = 0;
byte  butLast           = HIGH;

void setup()
{
    Serial.begin (9600);
    pinMode(ButPin, INPUT_PULLUP);      // configure with pullup
}

void loop() {
    byte  but = digitalRead(ButPin);    // read pin

    if (butLast != but)  {              // check for a change
        butLast = but;                  // capture new state

        if (LOW == but)  {              // check if FALLING
            buttonPushCounter++;
            Serial.println (buttonPushCounter);
        }
    }
}

I asked the teacher how it has to be my program has to be in a while loop when he hits the 3 eacht time so i created a new on but still o mis something

void setup()
{
  pinMode(8, INPUT_PULLUP);
  pinMode(4, OUTPUT);
  
}
void loop() {
delay(100);
int buttonpush = 0:
  
  while (buttonpush < 3){
    if (8 ==true )
    {
     buttonpush = buttonpush +1
    }
  }
  if (8 == false);
  {
    4 = true ;
  }
  if (8 == true)
  {
    4= false;
  }
}
 if (8 ==true )

Again?

Seriously, work through some examples.

Let it sink in.

if (8 == false); If you had worked through any of the examples, you would NEVER have seen a semicolon like that.
Not once

And of course, 8 will never be false

pin 8 may, of course, be HIGH or LOW if that helps