Pages: [1]   Go Down
Author Topic: arduino compile error  (Read 638 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 14 times.)
Logged

Offline Offline
Edison Member
*
Karma: 18
Posts: 1170
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
Online Online
Brattain Member
*****
Karma: 549
Posts: 46113
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: 239
Posts: 24371
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: 49
Posts: 3420
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
Offline Offline
Faraday Member
**
Karma: 60
Posts: 3242
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

Have you looked for answers in the Learning, Reference, Products and Playground tabs on http://arduino.cc/en/ ?
Look here http://electronicsclub.info/ for basic electronics

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 239
Posts: 24371
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
Offline Offline
Faraday Member
**
Karma: 82
Posts: 3123
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: