Pages: [1]   Go Down
Author Topic: arduino compile error  (Read 769 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hey i m new to this site......
actually m makin a line follower robot based on d PID algorithm....
m gettin a few compile errors

pid_n_linefollower:78: error: stray '\' in program
pid_n_linefollower:83: error: stray '\' in program
pid_n_linefollower:86: error: stray '\' in program
pid_n_linefollower:-1: error: expected initializer before 'current_position'
pid_n_linefollower:17: error: expected initializer before 'current_position'

ive attached d code ...
plz hlp me
thnxx in advance......  smiley


* pid_n_linefollower.ino (1.67 KB - downloaded 15 times.)
Logged

Offline Offline
Edison Member
*
Karma: 32
Posts: 1387
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, I see funky characters like this:
unsigned int Error = target_pos – current_pos;

so that is probably the problem. Whatever that is, it is not a C operator.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
unsigned int RPM of Left motor = pwm – (Correction);
unsigned int   RPM of Right motor = pwm + (Correction);
You can't have spaces in variable names.

Code:
calculate current_position ();
What is this supposed to be/do?

Code:
if (error==0)
  {
   analogWrite (RPM of Left motor,3) && analogWrite (RPM of Right motor,5)
  }
  if (error < 0)                                                      // line follower algorithm
  {
    analogWrite (RPM of Left motor,3);
  }
 
  if (error > 0)
  {
    analogWrite (RPM of Right motor,5);
  }
}
Putting the arguments in the correct order is useful, too.
Logged

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

thnxx 4 d reply .......
ive jus started with c and arduino n m nt a skilled c programmer.... smiley-sad
bt m learnin frm u ppl thnxx a lot
Code:
calculate current_position ();
What is this supposed to be/do?
itz to calculate the current position of d robot in respect to d line.....
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25795
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there something wrong with your vowel keys?
Your last post was hopelessly garbled.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

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

what are those expected initializers before....???
and     stray '\' in program
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 65
Posts: 3638
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's usually not very helpful to chase down every error the compiler produces - if you fix the first one, others will often vanish too. PaulS has pointed out a number of issues which you would be well advised to fix first. If you still have compiler issues then, post your amended code and the new error messages
Logged

Johannesburg. UTC+2
Online Online
Faraday Member
**
Karma: 82
Posts: 3846
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
if you fix the first one, others will often vanish too

I'll second that.... so often the case
Logged

The Elders of the Internet know who I am.....
Get me on LinkedIn: za.linkedin.com/in/jimbrownza/

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 290
Posts: 25795
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
analogWrite (RPM of Left motor,3) && analogWrite (RPM of Right motor,5)
Ignoring, for a moment, the spaces in the variable names, analogWrite doesn't return a value, so putting two in an expression like that doesn't make a lot of sense.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

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

@ AWOL
Code:
[analogWrite (RPM of Left motor,3) && analogWrite (RPM of Right motor,5)]

that was a mistake by me sry  :smiley-red: .........
bt ill try to fix d errors pointed by paulS
Logged

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

sry 4 d typing errors in d forum .....
bcoz m vry new to this forum
Logged

NE PA
Offline Offline
Full Member
***
Karma: 5
Posts: 156
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

O K Doe Kay
Logged


California
Online Online
Faraday Member
**
Karma: 88
Posts: 3364
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you very new to typing?

You aren't composing a text message, so don't type like it.
Logged

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

OK
Logged

Pages: [1]   Go Up
Jump to: