Error expected "}" at end of input

i'm new to the world of arduino, i made a alcohol gel dispenser but when i press the check button, it shows this error message: "expected "}" at end of input"

#include <LiquidCrystal_I2C.h>

#include <Wire.h>                //Biblioteca para I2C

#include <SparkFunMLX90614.h>    //Biblioteca SparkFunMLX90614

#define sensor A0

LiquidCrystal_I2C lcd(0x27, 16,2);

IRTherm therm;

int entrada;

int motor = 8; //porta digital para controle do motor bomba de água
int sensorGel = 11; //sensor frontal
int sensorLed =10; //sendor lateral
int led = 9; //portal digital para controle do led
int sensorGelEstado;
int sensorLedEstado;

void setup()
{
  pinMode(motor, OUTPUT);
  pinMode(led, OUTPUT);
  pinMode(sensorGel,INPUT);
  pinMode(sensorLed,INPUT);
  lcd.begin(16, 2);
  lcd.print("Temperatura: ");
  therm.begin();                  //Inicializa sensor de temperatura infravermelho
  therm.setUnit(TEMP_C);          //Seleciona temperatura em Celsius
}

void loop()
{

  if (therm.read()) // On success, read() will return 1, on fail 0.
{
  int sensorGelEstado = digitalRead(sensorGel);
 
  if (sensorGelEstado == HIGH) //nenhum objeto detectado
  {
    digitalWrite(motor,LOW); //desliga o motor
  }
  else  //objeto detectado
  {
    digitalWrite(motor,HIGH); //liga o motor por 1 segundo
    delay(1000);
    digitalWrite(motor,LOW); // desliga o motor e espera 1 segundo e meio para ser possível retirar a mão
    delay(1500);
  }

  sensorLedEstado = digitalRead(sensorLed);

  if (sensorLedEstado == HIGH) //nenhum objeto detectado

  {
    digitalWrite(led,LOW); // desliga o led
  }
  else  //objeto detectado
  {
    digitalWrite(led,HIGH); // liga o led por 3 segundos
    delay(3000);
    digitalWrite(led,LOW);
  }
{
   if (therm.read()) // On success, read() will return 1, on fail 0.
  {
    lcd.setCursor(0,0);
    lcd.print("Temperatura:");
    lcd.setCursor(0,1);
    lcd.print(therm.object(), 2);
    lcd.write('°');
    lcd.setCursor(6,1);
    lcd.print("C");
}


delay(2000);

}

The last character in a sketch should be a } at the end of a function

Auto format your code in the IDE and is that what you see ?

SPOILER ALERT : It's not.

It looks like you lost at least one }, probably two at the end of loop() or maybe you have too many earlier in the function

it's in the left margin, i just paste it here and all lines was in left margin

Read the how get the most out of this forum sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code in code tags.

thanks a lot!!

@senaicristhian u can try click the } to troubleshoot which is missing at every function you declare in the coding.

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