[SOLVED] arduino programming problem

Thread Starter

denison

Joined Oct 13, 2018
241
getting an error message in an arduino sketch. Here is the part causing the problem;
void setup() {
Serial.begin(9600);
pinMode(pin, INPUT);
pinMode(ledPin, OUTPUT);
}
keep getting" '}' needed at end of input", in error message. Then if I delete the input line I am still getting the same error message which doesn't make any sense at all. Input appears no where else in my programming. Anybody have a clue of the problem here? In another sketch with the same set up lines I had no error messages.
 

Yaakov

Joined Jan 27, 2019
3,565
The input in the error is not the constant INPUT, it is the compiler referring to your code. On it's face, it is saying you have unbalanced braces and there is a closing brace missing at the end of your program, which is the input to the compiler.

It's an unfortunate coincidence that they are the same word.

As @trebla said, we can really only help with all the code.
 

KeithWalker

Joined Jul 10, 2017
1,933
As Yaakov states, the problem is a missing closing brace }.
You can trouble shoot for the missing brace by starting at the end of the program. Place the cursor just after the last brace in the program. The corresponding opening brace for that section of code will be indicated by an outlining rectangle. By repeating this through the whole program will identify where you have a missing brace.
 

Thread Starter

denison

Joined Oct 13, 2018
241
As Yaakov states, the problem is a missing closing brace }.
You can trouble shoot for the missing brace by starting at the end of the program. Place the cursor just after the last brace in the program. The corresponding opening brace for that section of code will be indicated by an outlining rectangle. By repeating this through the whole program will identify where you have a missing brace.
Yes it must be a missing brace. I will do as you suggest. Mr Chips suggests a good way to avoid missing braces. Thanks. Getting much better answers here than on Arduino forum.
 

Thread Starter

denison

Joined Oct 13, 2018
241
As Yaakov states, the problem is a missing closing brace }.
You can trouble shoot for the missing brace by starting at the end of the program. Place the cursor just after the last brace in the program. The corresponding opening brace for that section of code will be indicated by an outlining rectangle. By repeating this through the whole program will identify where you have a missing brace.
Found it using your method. There was no closing brace to match Void Loop. There was a closing brace right at the end of my program but this matched a different opening brace. Thanks guys. All good replies.
 
Top