Arduino ide expected primary-expression before }

Hi guys i need a help i have a my fyp using a arduino my project name are automatic cat litter. My friend help me doing a coding and its working nicely but this morning i accidently press my keyboard when working on that coding and when i want to upload my coding to arduino its fail its say "arduino ide expected primary-expression before }" i doesnt know how to fix and my friend are going to vacation for 2weeks and i need to submit my coding by this week anyone know how to fix this.
This is my full coding

void setup() { //Setup runs once//

pinMode(11, OUTPUT); //Set Wpump as an output//
pinMode(9, INPUT); //Set sensorA as an input//
pinMode(10, INPUT); //Set sensorB as an input//
pinMode(7, OUTPUT); //Set CW as an output//
pinMode(8, OUTPUT); //Set CCW as an output//

}

void loop() { //Loop runs forever//

if(digitalRead(10) == HIGH)
{
digitalWrite(8, LOW);
digitalWrite(11, LOW);
delay(5000);
digitalWrite(11, HIGH);
delay(100);
digitalWrite(7, HIGH);
delay(1000);

}
else

{
digitalWrite(8, HIGH);
digitalWrite(11, HIGH);

}
{
if(digitalRead(9) == HIGH)
{
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(11, HIGH);
delay(5000);-+
}
else
{
}
}
}

Welcome to the forum

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

delay(5000);-+

Please explain what this line of code does (or should do)

code tags?

format the code?


void setup() { //Setup runs once//

  pinMode(11, OUTPUT); //Set Wpump as an output//
  pinMode(9, INPUT); //Set sensorA as an input//
  pinMode(10, INPUT); //Set sensorB as an input//
  pinMode(7, OUTPUT); //Set CW as an output//
  pinMode(8, OUTPUT); //Set CCW as an output//

}

void loop()
{ //Loop runs forever//

  if (digitalRead(10) == HIGH)
  {
    digitalWrite(8, LOW);
    digitalWrite(11, LOW);
    delay(5000);
    digitalWrite(11, HIGH);
    delay(100);
    digitalWrite(7, HIGH);
    delay(1000);

  }
  else

  {
    digitalWrite(8, HIGH);
    digitalWrite(11, HIGH);

  }
  {
    if (digitalRead(9) == HIGH)
    {
      digitalWrite(8, LOW);
      digitalWrite(7, LOW);
      digitalWrite(11, HIGH);
      delay(5000); - +
    }
    else
    {
    }
  }
  //}

See now you can see something is off.

Every { has to have a }.

You might have accidentally selected and deleted something.
We can not fill in the missing part.
There are three problems:

In general, you should not use magic numbers. The I/O pins love to have a functional name.

There is no need for an "else" here. If you don't want to do anything in an else clause then don't have it.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.