Arduino Programing Error

When i try to compile, the following comes up. is there a reason it comes out?


Arduino: 1.6.7 (Windows 9), Board: "Arduino/Genuino Uno"

arduino.robot:5: error: 'Servo' does not name a type

Servo servoLeft;

^

arduino.robot:6: error: 'Servo' does not name a type

Servo servoRight;

^

arduino.robot:13: error: 'servoLeft' was not declared in this scope

servoLeft.attach(10);

^

arduino.robot:14: error: 'servoRight' was not declared in this scope

servoRight.attach(9);

^

arduino.robot:24: error: 'servoLeft' was not declared in this scope

servoLeft.write(forward);

^

arduino.robot:25: error: 'servoRight' was not declared in this scope

servoRight.write(backward);

^

arduino.robot:54: error: expected ';' before 'delay'

delay(1500);

^

exit status 1
'Servo' does not name a type

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.


If I had to guess I would guess that you failed to include the Servo library.

Technically, that should be "the Servo header file". The Servo library consists of a header file and source file. Only the header file needs to be #included. The source file will be compiled separately.

Delta_G:
Well I was just guessing.

I think from now on when posters leave off their code I'm just going to reply with "Works for me" and let them guess at how their code may be different from mine.

I like that idea. 8)

I agree with Delta_G, it looks like the Servo class isn't included in your project.

This may help you.
http://playground.arduino.cc/Learning/SingleServoExample