how can i solve this problem in if and else with this error? [closed]

  c++

Here you can see the Error

enter image description here

I have this problem in my code for if and else:

int sensor = 4; // pir sensor pin
int drivpin2 = 5; // motor diver pin no2
int drivpin7 = 6; // motor diver pin no7
int led1 = 8; // led1
int led2 = 9; // led2
int led3 = 10; // led3
int piezo = 11; // poezo
int value = 0; // random variable

void setup()
{
    pinMode(led1, OUTPUT);
    pinMode(led2, OUTPUT);
    pinMode(led3, OUTPUT);
    pinMode(piezo, OUTPUT);
    pinMode(sensor, INPUT);
}

void loop()
{
    value = digitalRead(sensor); // reading the state of the pirpin and assigning to value

    if (value == HIGH) // condition when PIR detects motion
    {
        digitalWrite(led1, HIGH); // leds on
        digitalWrite(led2, HIGH);
        digitalWrite(led3, HIGH);
        digitalWrite(piezo, HIGH); // buzzer on
        digitalWrite(drivpin7, HIGH); // motor rotates in clockwise direction
        digitalWrite(drivpin2, LOW); // which opens the door
    }
  
    delay(100);

    else
    {
        digitalWrite(led1, LOW); // leds off
        digitalWrite(led2, LOW);
        digitalWrite(led3, LOW);
        digitalWrite(piezo, LOW); // buzzer off
        digitalWrite(drivpin7, LOW); // motor rotates in anti clockwise direction
        digitalWrite(drivpin2, HIGH); // by closing the door
    }

    delay(100);
}

Source: Windows Questions C++

LEAVE A COMMENT