Offline
Newbie
Karma: 0
Posts: 6
|
 |
« on: January 21, 2013, 12:34:39 pm » |
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...... 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 7
Posts: 386
|
 |
« Reply #1 on: January 21, 2013, 12:40:38 pm » |
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
Brattain Member
Karma: 311
Posts: 35470
Seattle, WA USA
|
 |
« Reply #2 on: January 21, 2013, 12:41:04 pm » |
unsigned int RPM of Left motor = pwm – (Correction); unsigned int RPM of Right motor = pwm + (Correction); You can't have spaces in variable names. calculate current_position (); What is this supposed to be/do? 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
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #3 on: January 21, 2013, 01:13:15 pm » |
thnxx 4 d reply ....... ive jus started with c and arduino n m nt a skilled c programmer....  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
Online
Brattain Member
Karma: 137
Posts: 19017
I don't think you connected the grounds, Dave.
|
 |
« Reply #4 on: January 21, 2013, 01:15:02 pm » |
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.
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #5 on: January 21, 2013, 01:16:25 pm » |
what are those expected initializers before....??? and stray '\' in program
|
|
|
|
|
Logged
|
|
|
|
|
New Jersey
Offline
Edison Member
Karma: 24
Posts: 2345
|
 |
« Reply #6 on: January 21, 2013, 01:57:30 pm » |
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
Edison Member
Karma: 34
Posts: 1705
|
 |
« Reply #7 on: January 21, 2013, 02:03:52 pm » |
if you fix the first one, others will often vanish too I'll second that.... so often the case
|
|
|
|
|
Logged
|
IT Crowd: Roy... "Have you tried turning it off and on again?" Moss.. "Have you tried forcing an unexpected reboot?"
|
|
|
|
Global Moderator
UK
Online
Brattain Member
Karma: 137
Posts: 19017
I don't think you connected the grounds, Dave.
|
 |
« Reply #8 on: January 21, 2013, 02:12:57 pm » |
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.
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #9 on: January 22, 2013, 12:35:55 am » |
@ AWOL [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
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #10 on: January 22, 2013, 12:38:20 am » |
sry 4 d typing errors in d forum ..... bcoz m vry new to this forum
|
|
|
|
|
Logged
|
|
|
|
|
NE PA
Offline
Full Member
Karma: 5
Posts: 149
|
 |
« Reply #11 on: January 22, 2013, 12:42:21 am » |
O K Doe Kay
|
|
|
|
|
Logged
|
|
|
|
|
California
Offline
Edison Member
Karma: 38
Posts: 1849
|
 |
« Reply #12 on: January 22, 2013, 12:43:28 am » |
Are you very new to typing?
You aren't composing a text message, so don't type like it.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 6
|
 |
« Reply #13 on: January 22, 2013, 12:50:05 am » |
OK
|
|
|
|
|
Logged
|
|
|
|
|
|