Arduino Forum

Using Arduino => Avrdude, stk500, Bootloader issues => Topic started by: baldstephan on Mar 17, 2018, 05:27 pm

Title: handwriten code will not compile
Post by: baldstephan on Mar 17, 2018, 05:27 pm

I don't get it !

this is what I wrote:


//example 01   : blinking LED


const int LED = 13            // LED conected to
                             //  digital pin 13
   
void setup() {                         

pinMode(LED, OUTPUT);     //  sets the digital
                              //  as output
}

,void loop()
{
  didgitawrite(LED, HIGH);     // turns the LED on
  delay(1000);                 // waits for one second
  didgitalwrite(LED, LOW);     // turns the LED off
  delay(1000);                 // waits for one second
   
}
                   


this is the error msg.


sketch_mar16a:7: error: expected ',' or ';' before 'void'

 void setup() {                         

 ^

sketch_mar16a:13: error: expected unqualified-id before ',' token

 ,void loop()

 ^

sketch_mar16a:13: error: expected unqualified-id before 'void'

 ,void loop()

  ^

exit status 1
expected ',' or ';' before 'void'

Thanks for the help!
Title: Re: handwriten code will not compile
Post by: sterretje on Mar 17, 2018, 05:33 pm
You have a comma before before void loop()

Next time please use code tags when posting code
Type [code]
Paste your code after that
Type [/code] after that
Title: Re: handwriten code will not compile
Post by: pert on Mar 17, 2018, 05:34 pm
Code: [Select]
sketch_mar16a:7: error: expected ',' or ';' before 'void'

 void setup() {                        

 ^

It's because you forgot the semicolon at the end of this line:
Code: [Select]
const int LED = 13    
Title: Re: handwriten code will not compile
Post by: larryd on Mar 17, 2018, 05:39 pm
Before writing any Arduino code, review the examples in the IDE to see how things are done.

You cannot invent your own syntax and expect things to work.



.
Title: Re: handwriten code will not compile
Post by: DrAzzy on Mar 17, 2018, 10:49 pm
Also, read those errors - they tell you where the compiler notices the problem, and for problems like this, the error is pretty clear...