Elegoo, lesson 9 Servo, Was working, then error, even when code reset to origin

Using the Elegoo ‘The Most Complete Starter Set’ and now stuck on lesson 9 ‘Servo’

This is the code

//www.elegoo.com
//2016.12.08
#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}



....


The brown servo lead is connected to ground
the red servo lead to 5v
The orange signal lead on the servo to pin 9 pwm on an Elegoo Uno R3 board



Now first time I tried this it worked

Then I started to change the figures in the line

 [code]for (pos = 180; pos >= 0; pos -= 1

Changing the 1 to 10, 20, 45 and 90 to speed up the return twist.

But when I set it to 180 all I get is error

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function ServoCount':** **(.text+0x0): multiple definition of ServoCount’
sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function ServoCount':** **(.text+0x0): multiple definition of __vector_11’
sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function ServoCount':** **(.text+0x0): multiple definition of Servo::Servo()'
sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function ServoCount':** **(.text+0x0): multiple definition of Servo::Servo()'
sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function ServoCount':** **(.text+0x0): multiple definition of Servo::attach(int, int, int)'
sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function ServoCount':** **(.text+0x0): multiple definition of Servo::attach(int)'
sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function ServoCount':** **(.text+0x0): multiple definition of Servo::detach()'
sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function ServoCount':** **(.text+0x0): multiple definition of Servo::writeMicroseconds(int)'
sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function ServoCount':** **(.text+0x0): multiple definition of Servo::write(int)'
sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function ServoCount':** **(.text+0x0): multiple definition of Servo::readMicroseconds()'
sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function ServoCount':** **(.text+0x0): multiple definition of Servo::read()'
sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function ServoCount':** **(.text+0x0): multiple definition of Servo::attached()'
sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.

I tried to go back to original numbers same error, but when I copied the original sketch code from the original zip file to revert the code in the folder I open it from to its factory setting code.

it is still not working so whats happening please?

Now when I tried this first time

[/code]

The problem has nothing to do with you setting it to 180. It seems like just a glitch in the Arduino IDE. Try restarting the Arduino. That will clear the compilation cache and hopefully solve the problem.

How exactly do I reset it?

I closed, quit and started the auduino software, then reset the computer and started it.

As said I replaced the code in the file with the original factory code for lesson 9, made sure the library was added as a zip file and still gettign errors.

//www.elegoo.com
//2016.12.08
#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}

ERRORS

Arduino: 1.8.5 (Windows 7), Board: “Arduino/Genuino Uno”

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount’:

(.text+0x0): multiple definition of `ServoCount’

sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount’:

(.text+0x0): multiple definition of `__vector_11’

sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount’:

(.text+0x0): multiple definition of `Servo::Servo()’

sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount’:

(.text+0x0): multiple definition of `Servo::Servo()’

sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount’:

(.text+0x0): multiple definition of `Servo::attach(int, int, int)’

sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount’:

(.text+0x0): multiple definition of `Servo::attach(int)’

sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount’:

(.text+0x0): multiple definition of `Servo::detach()’

sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount’:

(.text+0x0): multiple definition of `Servo::writeMicroseconds(int)’

sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount’:

(.text+0x0): multiple definition of `Servo::write(int)’

sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount’:

(.text+0x0): multiple definition of `Servo::readMicroseconds()’

sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount’:

(.text+0x0): multiple definition of `Servo::read()’

sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here

libraries\Servo\avr\Servo.cpp.o (symbol from plugin): In function `ServoCount’:

(.text+0x0): multiple definition of `Servo::attached()’

sketch\src\avr\Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

Before the servo stopped working was it getting hot?

That is all I can think of right now.

I have the same kit. If you tell the servo to go to 0 it buzzes. It gets hot.

Instead of going to 0 go to 15. More in line anyway.