Coding error at void set up

Hi all, Can anybody tell me what is wrong with this coding.
void setup()
{
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(pin, INPUT);
}
I keep getting '}' needed after INPUT. Had no trouble when I had just the Serial and output in void setup.

Please post your complete sketch

Please follow the advice given in the link below when posting code . Use code tags when posting code here to make it easier to read and copy for examination

#define ledPin 13
#define pin 12

void setup()
{
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(pin, INPUT);
}

void loop()
{
  
}

You have probably a bad character somewhere.
Try copy paste my working example.

Your post was MOVED to its current location as it is more suitable.

I don't get that error. I get:

sketch_jul27a.ino: In function 'void setup()':
sketch_jul27a:4:11: error: 'ledPin' was not declared in this scope
   pinMode(ledPin, OUTPUT);
           ^~~~~~

sketch_jul27a:5:11: error: 'pin' was not declared in this scope
   pinMode(pin, INPUT);
           ^~~

exit status 1
'ledPin' was not declared in this scope

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