Compilation error for SMARS sketch

Hello I am totally new to all of this so please be patient;
I have built a SMARS robot and trying out with the Basic control sketch which during verify compile gives the error;

exit status 1
Compilation error: 'Forward' was not declared in this scope

below is a copy of the sketch, I did notice that the colouring of the String and readString in the code is missing but couldn't see any mistakes. I have tried both V1 & V1.1 of AFMotor library.

#include <AFMotor.h>

AF_DCMotor MotorL(1);  //motor for drive Left on M1
AF_DCMotor MotorR(2);  //motor for drive Right on M2

String readString, action, Lspeed, Rspeed, actionDelay, stopDelay; //declaring multiple string

void setup() {
  Serial.begin(115200); // set up Serial Library at 115200 bps
  Serial.println("*SMARS Basic Mod*");

  // Set the speed to start, from 0 (off) to 255 (max speed)
  // sometimes the motors don't have the same speed, so use these values to make SMARS move straight
  MotorL.setSpeed(255);
  MotorR.setSpeed(255);

  //Move Forward
  MotorL.run(Forward);
  MotorR.run(Forward);
  delay(1000);

  // turn right
  MotorL.run(Forward);
  MotorR.run(Backward);
  delay(500);  // delay for 500 millisecond

  //Move Backward
  MotorL.run(Backward);
  MotorR.run(Backward);
  delay(1000);  // delay for 1 second

  // turn left
  MotorL.run(Backward);
  MotorR.run(Forward);
  delay(500);  // delay for 500 millisecond

  // turn off motor
  MotorL.run(Release);
  MotorR.run(Release);
}

void loop() {
  // No code here

}

Case matters. FORWARD, BACKWARD and RELEASE, not Forward, Backward and Release.

1 Like

Thank you very much 'van_der_decken' for your prompt reply, yes just compiled perfectly after correcting.
:smiley: you've made an old man very happy.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.