sketch_nov03a:6: error: expected initializer before 'if'

So basicly what's happening is that i just started programming on arduino, but i have faced two little errors, help please? Obs: I am not english, so i can't write that good, sorry :p~~

The errors are:
´sketch_nov03a:6: error: expected initializer before 'if'
sketch_nov03a:11: error: expected initializer before 'if'

void setup () {
pinMode (13, OUTPUT);
delay (1000);
}
void setup()
if (ultrasom() > 10)
{
motores(230,1,0);
}
void setup()
if (ultrasom() < 10)
{
motores (0,1,0);
pinMode (10, OUTPUT);
}

How many setup() functions are there in that program ?
Is that the whole program ?

Well, it's sopose to be, i wanted the robot, to, when it was 10centimeters away from the thing, used send a 5v thing to Slot10 and if it wasn't, to walk forward.

How many setups ? Don't know what that means xD, Sorry :;/

EDIT: How do i say to the robot, when it receives a signal from the sensor, to do for example, light up the led on slot1?

How many setups ? Don't know what that means xD, Sorry :;/

How many times does the word "setup" appear in that sketch?
How many times should the word "setup" appear in that sketch?

I don't know what Setup does for itself... But it should when receives a positive signal from the proximity sensor it should send an output to pin10, and if false, then continue walking.

How can i do that?

Thanks in advance
EDIT 1: That is the full sketch, i copied everyhing

:slight_smile: Sorry I can't help but laugh. If we take out everything you've got wrong, it leaves us with

You need to find a tutorial on programming the arduino. Start Start here and go through all the examples BARE MINIMUM would be a good start.

If i dont start somewhere, it will be a bit hard to learn....

KenF:
:slight_smile: Sorry I can't help but laugh. If we take out everything you've got wrong, it leaves us with

I disagree

void setup () {
  pinMode (13, OUTPUT);
  delay (1000);
}

is perfectly acceptable.

Well thank you AWOL :p, Good to know there are still people eager to help out the others :stuck_out_tongue:

AWOL:
I disagree

void setup () {

pinMode (13, OUTPUT);
 delay (1000);
}



is perfectly acceptable.

I think that's exactly what I tried to post, but my code box somehow got screwed up.

I think that's exactly what I tried to post, but my code box somehow got screwed up.

and I bet the dog ate your homework too :slight_smile:

UKHeliBob:
and I bet the dog ate your homework too :slight_smile:

ALL the time! He especially liked History :wink: