Error when using Servo.h library

When I add servo library and try to make test, I get error:

Arduino: 1.8.19 (Linux), Board:"Arduino Uno"
sketch_jul24a:4:1: error: 'Servoservovoid' does not name a type
 
 ^             
sketch_jul24a:7:1: error: expected initializer before 'void'
 void setup() {
 ^~~~
/home/arabric/Arduino/sketch_jul24a/sketch_jul24a.ino: In function 'void loop()':
sketch_jul24a:13:3: error: 'servo' was not declared in this scope
   servo.write(360);
   ^~~~~
/home/arabric/Arduino/sketch_jul24a/sketch_jul24a.ino:13:3: note: suggested alternative: 'Servo'
   servo.write(360);
   ^~~~~
   Servo
exit status 1
'Servoservovoid' does not name a type

There a code:

#include <Servo.h>

Servo servo

void setup() {
  servo.attach(5);

}

void loop() {
  servo.write(360);
}

Missing a ';' after Servo servo. That makes the compiler thinks you are saying:
Servo servo void setup()

Hah, lol) I keep forgetting)) Thanks man

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