Strange error with robot code

I keep getting the following error when trying to verify my sketch:

driver_9_23_2015.cpp: In function ‘void turn(int, char)’:
driver_9_23_2015.cpp:374:34: error: ‘l’ was not declared in this scope
driver_9_23_2015.cpp:375:11: error: expected ‘;’ before ‘analogWrite’

The turn function it is talking about looks like this:

/*
Functionally the same as drive, but motors turn in a
different configuration to allow turning.
rate = turn rate (speed) between 0 and 255
dir = direction of rotation r = right, l = left
*/
void turn(int rate, char dir)
{
    Serial.println("turn ack");
    if(dir == 'r')
    {
          analogWrite(M1_PWM, rate);
          digitalWrite(M1_DIR, 1);
          analogWrite(M2_PWM, rate);
          digitalWrite(M2_DIR, 0);
          analogWrite(M3_PWM, rate);
          digitalWrite(M3_DIR, 0);
          analogWrite(M4_PWM, rate);
          digitalWrite(M4_DIR, 1);
    }
    else if(dir == 'l')
    {
          analogWrite(M1_PWM, rate);
          digitalWrite(M1_DIR, 0);
          analogWrite(M2_PWM, rate);
          digitalWrite(M2_DIR, 1);
          analogWrite(M3_PWM, rate);
          digitalWrite(M3_DIR, 1);
          analogWrite(M4_PWM, rate);
          digitalWrite(M4_DIR, 0);
    }
    else
    {
          Serial.println(ERR_CODE);
          Serial.println(rate);
          Serial.println(dir);
          analogWrite(M1_PWM, 0);
          analogWrite(M2_PWM, 0);
          analogWrite(M3_PWM, 0);l

whole code here: http://pastebin.com/Bc8mhDtH

Doesnt seem to make sense to me since 'l' in this context is a constant value used for comparison. Not a variable that needs declaration.

Last line in your posted code:

analogWrite(M3_PWM, 0);l

Got an extra something hanging out on the end there.

Oh wow I’ve been looking at it for hours without noticing that. Thank you so much, just needed another set of eyes haha :slight_smile: