Programing Error


int LEDpin = 2; // connect MIC pin 4 to Arduino pin 2

void setup() {

  pinMode(LEDpin, OUTPUT); // Tells the arduino which pin is used
  
}

if (LEDpin = 2)
{
  void loop() 
  {

    digitalWrite(LEDpin, HIGH); // Turn the LED on
    Serial.println("LED IS ON"); // display text to verify led is on
    delay(1000); // Wait for 1 second
    digitalWrite(LEDpin, LOW); // Turn the LED off
    Serial.println("LED IS OFF"); // display text to verify led is off
    delay(3000); // Wait for 3 second

  }
}

else 
{

  digitalWrite(LEDpin, LOW); // Turn the LED off

}**strong text**

You have code outside of a function

void setup()
{
    pinMode(LEDpin, OUTPUT);  // Tells the arduino which pin is used
}

if (LEDpin = 2)
{

Also, that statement would set LEDPin to 2 rather than comparing it with 2

Please describe what you expect your sketch to do

@mbanks Your previous thread ended in silence after people requested information. This thread seems to be going the same way. There are many folk here willing to help you with Arduino issues, but we can't work in a vacuum. You must participate.

Perhaps it's time you reviewed the forum guidelines:

Thank you