Any quick pointers of what I'm doing wrong?

I'm trying to get the LED to switch off after 3 presses of the pushButton

const int ledPin = 4;
const int buttonPin = 7;	
int buttonState = 0;
int count = 0;
void setup ()
{}
void loop (){
    digitalWrite(ledPin, HIGH);
  buttonState = digitalRead(buttonPin);
  if (buttonState == LOW);
  count++;
  delay(0250);
    buttonState = digitalRead(buttonPin);
  if (buttonState == LOW);
  count++;
  buttonState = digitalRead(buttonPin);
  if (buttonState == LOW);
  count++;
  if (count = 3);
  {digitalWrite(ledPin, LOW);}
  
}

Any pointers?

No semicolon after an "if"

Equality comparisons use "==" not "="

delay(0250); Why not simply delay(168);

const int ledPin = 4;
const int buttonPin = 7;	
int buttonState = 0;
int count = 0;
void setup ()
{}
void loop (){
  digitalWrite(ledPin, HIGH);
  buttonState = digitalRead(buttonPin);
  if (buttonState == LOW)
  {count++;
   delay(168);}
  if (buttonState == LOW)
  {count++;
   delay(168);}
  if (buttonState == LOW)
  {count++;}
    delay(168);
   if (count == 3)
  {digitalWrite(ledPin, LOW);}
  
}

Thanks for your response. Still can't get it to shut off the led after the third press...

You're thinking like a human, in human timescales.

Why 168 milliseconds?

Your code reads the state of the button once and checks the state three times. You need to count how many times the state of the button changes and react to the third change.

One obvious problem is that the pinMode() of the LED pin is not set to OUTPUT which means that it is defined as an INPUT by default

Is it not doing the adding correctly? I've set 3 counts to be the trigger for shutting off the led but why after 3 counts is it not doing so?
i tried adding a serial print for first press but nothing registers
void loop (){
digitalWrite(ledPin, HIGH);
if (buttonState == LOW)
{count++;
delay(168);
Serial.print("ONE COUNT:");}

Why not count when the input transitions from HIGH to LOW?

Why did you decide on 168 milliseconds?

TheMemberFormerlyKnownAsAWOL:
You're thinking like a human, in human timescales.

Why 168 milliseconds?

oh I thought you suggested that? I wanted to have it at 0250

0250 is 168

I wanted to have it at 0250

That is what you have got but the leading zero will cause the compiler to interpret the number as being in base 8 (octal) form.

250 in octal is 168 in decimal

UKHeliBob:
That is what you have got but the leading zero will cause the compiler to interpret the number as being in base 8 (octal) form.

250 in octal is 168 in decimal

@premobowei, this is at least the third one of your threads on this forum where you've been told exactly what @UKHeliBob is telling you above. And, it's at least the third thread where you've ignored the message. How is it that you're incapable of understanding this? DO NOT PUT A LEADING ZERO IN FRONT OF YOUR NUMERIC CONSTANTS!!! It's that simple. If you want 250, then write 250, not 0250. If you're too thick to understand that, then I suggest picking a different activity than programming. The details really matter here.

const int ledPin = 4;
const int buttonPin = 7;	
int buttonState = 0;
int lastButtonState = 0;
int count = 0;
void setup ()
{buttonState = digitalRead(buttonPin);
 pinMode (ledPin, OUTPUT);
 pinMode (buttonPin, INPUT);
}
void loop (){
  digitalWrite(ledPin, HIGH);
  
  buttonState;
  if (buttonState == LOW)
  {count++;
   delay(250);
  Serial.print("ONE COUNT:");}
  buttonState;
  if (buttonState == lastButtonState)
  {count++;
   delay(250);}
    digitalRead(buttonPin);
  if (buttonState == lastButtonState)
  {count++;}
    delay(250);
   if (count == 3)
  {digitalWrite(ledPin, LOW);}
  
}

I made these changes. Still nothing. Still can't get the serial monitor to print after the first button

const int ledPin = 4;
const int buttonPin = 7;	
int buttonState = 0;
int lastButtonState = 0;
int count = 0;
void setup ()
{buttonState = digitalRead(buttonPin);
 pinMode (ledPin, OUTPUT);
 pinMode (buttonPin, INPUT);
}
void loop (){
  digitalWrite(ledPin, HIGH);
  delay (3000);
  buttonState;
  if (buttonState == HIGH)
  {Serial.print("HIGH:");}
   else {count++;
        Serial.print("1");}
   delay(250);
  buttonState;
  if (buttonState == lastButtonState)
  {count++;
   delay(250);}
  buttonState;
  if (buttonState == lastButtonState)
  {count++;}
    delay(250);
  if (buttonState == lastButtonState)
  {digitalWrite(ledPin, LOW);}
}

I also tried the if else and nothing... : ((

UPDATE: I got the serial to print but it keeps printing HIGH even without any button being pressed and even after pressed.

premobowei:
UPDATE: I got the serial to print but it keeps printing HIGH even without any button being pressed and even after pressed.

We can't see your code.

tried a different approach entirely...still nothing

const int ledPin = 4;
const int buttonPin = 7;	
int buttonState = 0;
int lastButtonState = 0;
int buttonArray[7];
int loopCounter = 0;
int count = 0;
void setup ()
{buttonState = digitalRead(buttonPin);
 pinMode (ledPin, OUTPUT);
 Serial.begin(9600);
 pinMode (buttonPin, INPUT);
}
void loop (){
    digitalWrite(ledPin, HIGH);
  loopCounter = 0;
  do 
  {if (digitalRead(buttonPin) == LOW) (
    buttonArray[loopCounter] = 1);
    loopCounter++;
    delay(250);}
  while (loopCounter < 3);
if (loopCounter == 3)
{digitalWrite(ledPin, LOW);}}

You're still looking at states, not transitions.

Braces go in their own lines. That's just a legibility thing.

?

const int ledPin = 4;
const int buttonPin = 7;	
int buttonState = 0;
int lastButtonState = 0;
int buttonArray[7];
int loopCounter = 0;
int count = 0;
void setup ()
{buttonState = digitalRead(buttonPin);
 pinMode (ledPin, OUTPUT);
 Serial.begin(9600);
 pinMode (buttonPin, INPUT);
}
void loop (){
  digitalWrite(ledPin, HIGH);
  do{
  if (buttonState != lastButtonState)
  {loopCounter=1;
   loopCounter++;}
    
  }
  while (loopCounter < 3);
    {digitalWrite(ledPin, LOW);}
  }

I'm trying to get every time the button state doesn't equal to the initial high state to count as one loop? how is that not change?

loopCounter=1;
   loopCounter++;}

Oops

Please, get used to using the IDE's auto-format tool before posting code.