How to fix "expected declaration before ‘ ’ token"

Hi everyone. I tried to make FOOD CALORI CALCULATOR using Load Cell + HX711 + arduino uno. But i got errors

Here is my code

#include <LiquidCrystal.h>
#include <math.h>
#include <HX711.h>

#define button1 8
#define button2 9
#define button3 A3
#define button4 A4
#define button5 A5
// list of the food, sorry its indonesian languange
#define __NASI 0 //180
#define __PEPAYA 1 //46
#define __PISANG 2 //127
#define __APEL 3 //58
#define __BAYAM_REBUS 4 //23
#define __KANGKUNG_REBUS 5 //22
#define __KENTANG_REBUS 6 //62
#define __AYAM_GORENG 7 //270
#define __KEJU 8 //326
char str[16];
char strFloat[10];
float kaloriList[13] = {1.8, 0.46, 1.27, 0.58,
0.23, 0.22, 0.62, 2.70, 3.26};
char* kaloriName[13] = 
{" NASI ",
 " PEPAYA ",
 " PISANG ",
 " APEL ",
 " BAYAM REBUS ",
 " KANGKUNG REBUS ",
 " KENTANG_REBUS ",
 " AYAM GORENG ",
 " KEJU "};
char choice=0;
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
float berat,kalori;
// HX711.DOUT - pin #A1
// HX711.PD_SCK - pin #A0
HX711 scale(A1, A0); // parameter "gain" is ommited;
// the default value 128 is used by the library
void resetScale()
{
 scale.tare();
 lcd.clear();
 lcd.setCursor(0,0);
 lcd.print(" RESET ");
 delay(500);
}
void readScale() 
{
 if(digitalRead(tombol3)==0)
 {
 resetScale();
 }

}
void readButton()
{
 char button1Var = digitalRead(button1);
 char button2Var = digitalRead(button2);
 char button3Var = digitalRead(button3);
 char button4Var = digitalRead(button4);
 char button5Var = digitalRead(button5);
 } 
 }
 }
 if(!button3Var)
 {
 resetScale();
 }
 if(!button1Var)
 {
 choice++;
 if(choice>12)
 choice=0;
 delay(200);
 }

 if(!button2Var){
 choice--;
 if(choice<0)
 choice=12;
 delay(200);
 }
 delay(50);
}
void setup() {
 pinMode(button1, INPUT);
 pinMode(button2, INPUT);
 pinMode(button3, INPUT);
 pinMode(button4, INPUT);
 pinMode(button5, INPUT);
 digitalWrite(button1, HIGH);
 digitalWrite(button2, HIGH);
 digitalWrite(button3, HIGH);
 digitalWrite(button4, HIGH);
 digitalWrite(button5, HIGH);
 lcd.begin(16, 2);
 lcd.clear();
 lcd.print("PREPARATION..");
 Serial.begin(38400);
 Serial.println("HX711 Demo");
 Serial.println("Readings:");
 delay(2000);
 lcd.clear();
}
void loop() {
 lcd.setCursor(0,0);
 lcd.print(" FOODS : ");

 lcd.setCursor(0,1);
 lcd.print(kaloriName[choice]);
 readButton();
}

Here is the error message

exit status 1
expected declaration before '}' token

Location of error

void readButton()
{
 char button1Var = digitalRead(button1);
 char button2Var = digitalRead(button2);
 char button3Var = digitalRead(button3);
 char button4Var = digitalRead(button4);
 char button5Var = digitalRead(button5);
 } 
 } // <<<< ERRORRRRR
 }

Please help me to fix it. Thanks for the attention.

That is just a small part of the error message... In my opinion even the less important part of the message...

What line is the error on? Please post the complete message.

[b] } [[b] b]

What is this?

Check your brackets. CTRL+T (auto-format) will show you that there's something wrong with your curly braces on lines 65-69.

Pieter

I love nasi so just check where your readButtons function ends (hint: just before what you tried to mark with bold) and think why you have code after that.

Use tools->autoformat in the IDE and you will probably see where you go wrong.

PieterP:
What line is the error on? Please post the complete message.
What is this?

Check your brackets. CTRL+T (auto-format) will show you that there's something wrong with your curly braces on lines 65-69.

Pieter

I've tried to bold the error code location but it doesn't word so i just tagged it

sterretje:
I love nasi so just check where your readButtons function ends (hint: just before what you tried to mark with bold) and think why you have code after that.

Use tools->autoformat in the IDE and you will probably see where you go wrong.

are you indonesian btw? :smiley:

Thank you, i'll try

Onchyzuki:
are you indonesian btw? :smiley:

Dutch, living in South Africa.

septillion:
That is just a small part of the error message... In my opinion even the less important part of the message...

please help me how to fix it

Onchyzuki:
please help me how to fix it

Delete the extra curly brace.

You really need to do some reading and understand how to use braces "{" and "}" - they are VERY important! How does this make sense to you?

void readButton()
{
 char button1Var = digitalRead(button1);
 char button2Var = digitalRead(button2);
 char button3Var = digitalRead(button3);
 char button4Var = digitalRead(button4);
 char button5Var = digitalRead(button5);
 } 
 }
 }

Regards,
Ray L.

It's expecting stuff before a }
Either give it stuff or take away the }

Like having a single shoe. Find the other one or get rid of the one you found.

Thank you everyone, i've deleted the extra "}" and its working. :slight_smile:

You do understand that '{' and '}' come in pairs, right?

Some people have extras because they type in both open and close brackets, but didn't notice how the IDE sometimes automatically throws in the closing one.