1
void setup()
{

  pinMode{13, OUTPUT};

}

void loop() {

  digitalWrite{13, HIGH};

}
  • 1
    Use digitalWrite(13,HIGH); rather than curly brackets, and do the same for pinMode – MichaelT May 23 at 7:31
  • 1
    Why ard you using {} brackets after function name? – AnT May 23 at 7:57
3

Try parentheses instead of curly braces:

void setup() {

pinMode(13, OUTPUT);

}

void loop() {

digitalWrite(13, HIGH);

}
  • 1
    It's funny and nonsense, but pinMode; { ... is formally correct. That makes error messages hard to understand. – DataFiddler May 23 at 7:30
1

The solution is already give, but here an explanation:

{ and } are used to group multiple statements together, either for a function, if, while, for loop and so on.

E.g.

if (i == 1)
{
  // Statement 1
  // Statement 2
}

or a function

void f()
{
  // Statement 1
  // Statement 2
}

( and ) are used to specify parameters:

void f(int a, int b) 
{
  ...
}

A function with two parameters.

When calling this function, the following is used:

f(1, 2);

Calls function f with a = 1, and b = 2.

So in general: { and } is for grouping statements, ( and ) for parameters.

  • {} is also used in initializer syntax, which might lead to other confusing error messages for incorrect code. – AnT May 23 at 22:29
  • @AnT True, I didn't make a complete list to make my answer not overly difficult for beginners. {} is also used for begin/end of a class as other example. – Michel Keijzers May 23 at 22:34
0

I made same mistake when I started working with C

you have

pinMode{13, OUTPUT};

which should be

pinMode(13, OUTPUT);

the curly brackets are basically for Start and End of a function.

Bill

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.