Pages: [1]   Go Down
Author Topic: Can't program basic circuits!  (Read 382 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
So, I just got a basic Arduino Uno board with some example circuits in the guide. Just to get used to programming, I have built a basic blinking LED connected to pin 13.
However, whenever I try to upload code, it will not work.
error: expected constructor, destructor, or type conversion before '(' token
is the error message. This comes up even when uploading simple code like
pinMode(13,OUTPUT);

I know if I can fix this I will quickly get to grips with programming, but just can't fix this error!
Please Help!!
Logged

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4339
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Post your whole program otherwise we are just guessing at what the problem might be
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 503
Posts: 19089
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How to use this forum

Post your code, there will be something wrong there.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My code:

void setup()
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);


I know it's basic but its just to get me started.
Logged

Offline Offline
Edison Member
*
Karma: 33
Posts: 1468
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need to surround your code with {}.

Look at the examples!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Still wont work!!
sketch_mar07d:6: error: expected constructor, destructor, or type conversion before '(' token

Really confused?!?!?!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

sketch_mar07d:6: error: expected declaration before '}' token
Code:
{void setup()
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);}
delay(1000);
digitalWrite(13, LOW);
delay(1000);}
[code/]
« Last Edit: March 07, 2013, 04:23:48 pm by Kparv » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 503
Posts: 19089
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Please edit your post, select the code, and put it between [code] ... [/code] tags.

You can do that by hitting the # button above the posting area.

This was explained here: How to use this forum


Code:
void setup()
{
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);
}

Look at the examples. Don't just leave stuff out or put braces wherever you feel like it.
Logged


Pages: [1]   Go Up
Jump to: