arduino compile error

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...... :slight_smile:

pid_n_linefollower.ino (1.67 KB)

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.

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.

thnxx 4 d reply .......
ive jus started with c and arduino n m nt a skilled c programmer.... :frowning:
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.....

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

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

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

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

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

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.

@ AWOL

[analogWrite (RPM of Left motor,3) && analogWrite (RPM of Right motor,5)]

that was a mistake by me sry  :blush: .........
bt ill try to fix d errors pointed by paulS

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

O K Doe Kay

Are you very new to typing?

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

OK