expected '}' at end of input

Hi,

I was tying to upload a bit of code to my arduino and kept on getting this error:

D:\My_Watlow\My_Watlow.ino: In function ‘void loop()’:

My_Watlow:58: error: expected ‘}’ at end of input

}}

^

exit status 1
expected ‘}’ at end of input

Any help is great thank you.

Here is the code:

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <max6675.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
int thermoDO = 7;
int thermoCS = 5;
int thermoCLK = 6;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
int val;
int encoder0PinA = 3;
int encoder0PinB = 4;
int encoder0Pos = 0;
int encoder0PinALast = LOW;
int n = LOW;

void setup() {
pinMode (9, OUTPUT);
pinMode (10, OUTPUT);
pinMode (encoder0PinA, INPUT);
pinMode (encoder0PinB, INPUT);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
delay(500);
}

void loop() {
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.print("F = ");
display.println(thermocouple.readFahrenheit());
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 1);
display.print("F = ");
display.println(encoder0Pos);
n = digitalRead(encoder0PinA);
if ((encoder0PinALast == LOW) && (n == HIGH)) {
if (digitalRead(encoder0PinB) == LOW) {
encoder0Pos–;
} else {
encoder0Pos++;
if (thermocouple.readFahrenheit() > encoder0Pos) {
digitalWrite(10, LOW);// set pin 10 LOW
} else {
digitalWrite(10, HIGH);// set pin 10 HIGH
if (thermocouple.readFahrenheit() > encoder0Pos) {
digitalWrite(9, HIGH);
delay(5000);
digitalWrite(9, LOW);
} else {
digitalWrite(9, LOW);
}
delay(1000);
}
}}

Add another '}' at the end

Please read the posts pertaining to posting code using code tags. Clearly titled at the start of the forum "Read this before posting a programming question..."

Very few will look at your code as it is posted now.

dkw

Suggestions :

1 - Put each { and } on its own line with no other code
2 - Auto Format the code in the IDE. Auto Format can be configured to do step 1 for you

Each function should end with a } on the left margin. If it doesn't then you have either got more { than you should have or fewer } than you should have

Hello Blueelectronics,

I think that arduino_new is right.

You could try that :

When you click just on the right of “{” or just on the left of “}” , the coresponding “}” or “{” is highlighted.

Regards,
bidouilleelec

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Is this part of your code?
Did you try what was suggested?

Can you please tell us your electronics, programming, Arduino, hardware experience?

Thanks.. Tom.. :slight_smile:

When you click just on the right of "{" or just on the left of "}" , the coresponding "}" or "{" is highlighted.

It used to be that when you double clicked on a { or } the code block contained between them was highlighted, but this excellent feature was removed at some time. It is partially made up for by showing the extent of the code block if the cursor is placed in the margin when code folding is turned on, but the old way was so much more obvious and was a great help when copy/pasting or moving code around.

Hello UKHeliBob,

UKHeliBob:
It used to be that when you double clicked on a { or } the code block contained between them was highlighted, but this excellent feature was removed at some time. It is partially made up for by showing the extent of the code block if the cursor is placed in the margin when code folding is turned on, but the old way was so much more obvious and was a great help when copy/pasting or moving code around.

That's still work with Windows 10 , IDE 1.8.5.
You should try it.
Another solution is to use Notepad++.

Regards,
bidouilleelec

That's still work with Windows 10 , IDE 1.8.5.
You should try it.

Well, it isn't working here whether or not code folding is turned on.
Windows 10
IDE version 1.8.5

I would be interested to hear whether it works for other users with the same combination of Windows and IDE version

Hello UKHelyBob,

Excuse my approximate english.

Trying to be more precise :

The corresponding curly brace is not highlighted but the corresponding curly brace appears inside a rectangle.

Regards,
bidouilleelec

The corresponding curly brace is not highlighted but the corresponding curly brace appears inside a rectangle.

Yes, that works, but what I was lamenting was the fact that the whole code block highlighting had been removed

Hello UKHheliBob

Ok.
Thanks for your messages.

O.T. :
Have you been working in helicopter area?
I did , and I liked (loved) it.

Regards,
bidouilleelec.

Have you been working in helicopter area?

My username refers to me flying model helicopters rather than real ones !

Hello UKHeliBob,

Moreover: when the line with the { or } is not visible on the screen, clicking just after { or just before } makes this line to appear highlighted in a little yellow screen.

Regards,
bidouilleelec

when the line with the { or } is not visible on the screen, clicking just after { or just before } makes this line to appear highlighted in a little yellow screen.

I am aware of that and it works but can I be clear, with this in the IDE

void setup()
{
  Serial.begin(115200);
}

void loop()
{
}

what happens when you double click to the right of either of the curly braces of the setup() function ? It used to be that the whole setup() function would be highlighted. This stopped working for me when I upgraded the IDE at some time

Windows 10
IDE 1.8.5

This stopped working for me when I upgraded the IDE at some time

Oh!
I began with 1.8.4 !
So I never saw that.

Regards,
bidouilleelec