Please help with ARDUINO-UNO Project

Hello everyone, im new… Im 13 years old… And me and my dad are working into a science fair project wich consists of a stick for walking, for people with vision dishabilities the idea is that the stick vibrates when obstacles are found and… No… im not asking for help with my project… the thing is… That my very first code on ARDUINO software is sending out errors when im trying to solve them … :confused: Anyways… ive been trying to solve my code but… it just throws up more errors :c im natural-spanish and i learned english on my school… i didnt feeled like going on to Spanish Forums because i think that people that speak english are more experienced and stuff… and as i dont know that Lot of english i couldnt find an answer to my problems… So thanks for reading, here is my code There just 2 errors Hope someone can help me… Thanks.
Link: http://prntscr.com/66ejme

Screenshot:

Code:

int Pin_echo = 13;
int Pin_Trig = 12;
int Vibrador = 5;
int Buzzer = 4;

void setup() {
Serial.begin (9600);
pinMode(Vibrador,OUTPUT);
pinMode(Buzzer,OUTPUT);
pinMode(Pin_Trig,OUTPUT);
pinMode(Pin_echo,INPUT);



}

void loop(){
int duracion, cm;
digitalWrite(Pin_Trig, LOW);
delayMicroseconds(2);
digitalWrite(Pin_Trig, HIGH);
delayMicroseconds(10);
digitalWrite(Pin_Trig, LOW);
duracion = pulseIn(Pin_Trig, LOW);
cm = duracion / 29 / 2;
Serial.print("Distancia:");
Serial.print(cm);
Serial.print(" cm");
if (cm>40);
{
   digitalWrite(Vibrador, LOW);
   digitalWrite(Buzzer, LOW);
}
if else(cm<40);
{
  digitalWrite(Vibrador, HIGH);
  digitalWrite(Buzzer, HIGH);
}
delay(500);
}

Post your actual code, using code tags (the button that looks like a paper scroll). The screen shot is not readable.

if (cm > 40);

Lose the semicolon

Satzuna: Hello everyone, im new... Im 13 years old.. And me and my dad are working into a science fair project

So welcome to the forum, you and your dad!

Satzuna: im natural-spanish and i learned english on my school... i didnt feeled like going on to Spanish Forums because i think that people that speak english are more experienced and stuff... and as i dont know that Lot of english i couldnt find an answer to my problems...

If you'd like people to help you in the English language forum, perhaps you'd give your variable names English names and add comments in English where the code is not self-explaining.

And please: Screenshot

Don't do that!

Please learn how to copy-and-paste your code from the code editor into a forums message and always use "code tags" when doing so. Code tags look like:

[code*]* // insert code here [/code*]*

CrossRoads: Post your actual code, using code tags (the button that looks like a paper scroll). The screen shot is not readable.

Thanks.. i updated it already.

AWOL: if (cm > 40);

Lose the semicolon

Excuse me... What means to "Lose" It is to Delete or..?

jurs: So welcome to the forum, you and your dad!

If you'd like people to help you in the English language forum, perhaps you'd give your variable names English names and add comments in English where the code is not self-explaining.

And please: Screenshot

Don't do that!

Please learn how to copy-and-paste your code from the code editor into a forums message and always use "code tags" when doing so. Code tags look like:

[code*]* // insert code here [/code*]*

Thanks for the advice

Satzuna: Excuse me... What means to "Lose" It is to Delete or..?

English is not my mother language, either.

In English there is the saying "lose it or use it", and so I assume, that "lose it" must be the opposite of "use it". ;)

jurs: English is not my mother language, either.

In English there is the saying "lose it or use it", and so I assume, that "lose it" must be the opposite of "use it". ;)

Oh... i did lose it but it keeps throwing errors. Same ones in screenshot.

Time to post your code again.

AWOL:
Time to post your code again.

int Pin_echo = 13;
int Pin_Trig = 12;
int Vibrador = 5;
int Buzzer = 4;

void setup() {
Serial.begin (9600);
pinMode(Vibrador,OUTPUT);
pinMode(Buzzer,OUTPUT);
pinMode(Pin_Trig,OUTPUT);
pinMode(Pin_echo,INPUT);



}

void loop(){
int duracion, cm;
digitalWrite(Pin_Trig, LOW);
delayMicroseconds(2);
digitalWrite(Pin_Trig, HIGH);
delayMicroseconds(10);
digitalWrite(Pin_Trig, LOW);
duracion = pulseIn(Pin_Trig, LOW);
cm = duracion / 29 / 2;
Serial.print("Distancia:");
Serial.print(cm);
Serial.print(" cm");
if (cm > 40)
{
   digitalWrite(Vibrador, LOW);
   digitalWrite(Buzzer, LOW);
}
if ()else(cm < 40)
{
  digitalWrite(Vibrador, HIGH);
  digitalWrite(Buzzer, HIGH);
}
delay(500);
} int Pin_echo = 13;
int Pin_Trig = 12;
int Vibrador = 5;
int Buzzer = 4;

void setup() {
Serial.begin (9600);
pinMode(Vibrador,OUTPUT);
pinMode(Buzzer,OUTPUT);
pinMode(Pin_Trig,OUTPUT);
pinMode(Pin_echo,INPUT);



}

void loop(){
int duracion, cm;
digitalWrite(Pin_Trig, LOW);
delayMicroseconds(2);
digitalWrite(Pin_Trig, HIGH);
delayMicroseconds(10);
digitalWrite(Pin_Trig, LOW);
duracion = pulseIn(Pin_Trig, LOW);
cm = duracion / 29 / 2;
Serial.print("Distancia:");
Serial.print(cm);
Serial.print(" cm");
if (cm > 40)
{
   digitalWrite(Vibrador, LOW);
   digitalWrite(Buzzer, LOW);
}
if ()else(cm < 40)
{
  digitalWrite(Vibrador, HIGH);
  digitalWrite(Buzzer, HIGH);
}
delay(500);
}int Pin_echo = 13;
int Pin_Trig = 12;
int Vibrador = 5;
int Buzzer = 4;

void setup() {
Serial.begin (9600);
pinMode(Vibrador,OUTPUT);
pinMode(Buzzer,OUTPUT);
pinMode(Pin_Trig,OUTPUT);
pinMode(Pin_echo,INPUT);



}

void loop(){
int duracion, cm;
digitalWrite(Pin_Trig, LOW);
delayMicroseconds(2);
digitalWrite(Pin_Trig, HIGH);
delayMicroseconds(10);
digitalWrite(Pin_Trig, LOW);
duracion = pulseIn(Pin_Trig, LOW);
cm = duracion / 29 / 2;
Serial.print("Distancia:");
Serial.print(cm);
Serial.print(" cm");
if (cm > 40)
{
   digitalWrite(Vibrador, LOW);
   digitalWrite(Buzzer, LOW);
}
if ()else(cm < 40)
{
  digitalWrite(Vibrador, HIGH);
  digitalWrite(Buzzer, HIGH);
}
delay(500);
}
if ()else(cm < 40)
else if (cm < 40)

One “loop()”, one “setup()” per sketch only.

Didnt noticed i added a () before "else" Another error showed up... What is a primary-expression? 1) In function 'void loop() ' : 2) expected primary-expression before 'else' 3) expected ')' before else Can someone just Modify the code please? so it just as no errors? please?

AWOL:

if ()else(cm < 40)
else if (cm < 40)

One “loop()”, one “setup()” per sketch only.

NVM THANKS!

Welcome to the forum FYI, In the future, to post your compiler errors, click "Files\preferences" in the IDE, select Verbose output, then compile and when you get the errors , (with a Windows PC), place the mouse cursor over the compiler output window where the errors are and LEFT MOUSE CLICK. (to select the entire compiler output window to be highlighted) Then Control-A, (to highlight the compiler output text) Control-C, (to copy it) Open Notepad and place the mouse cursor in the notepad window and Control-V (to paste it) .

Save the file and post it as an attachment.

Compiler give you error message about code line 34, sorry, I do not see that clearly, So you can follow the compiler's guide to that line, so the error is there and also the answer will be there.

By my coding experience, you encounter a grammar error, so here is the guide for coding reference. http://arduino.cc/en/Reference/HomePage

most of time, the answer is there, don't think here has a lot of tigers, you can get answer by yourself. hope reference help you, Good luck.