Help!! Error Message - using Sweep Servo Sketch

I am new to Arduino programming. I have taken C+ courses but have no experience. NEWBEE

I am attempting to start using a servo. I can’t even get the basic servo example to work. Is my <Servo.h> library in the correct position. Thanks for the guidance.

I keep getting the following error message.

Arduino: 1.0.6 (Windows 7), Board: “Arduino Uno”
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -IC:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\variants\standard -IC:\Users\Kirsten\Documents\Arduino\libraries\Servo C:\Users\Kirsten\AppData\Local\Temp\build5952589283937804508.tmp\sketch_oct28b.cpp -o C:\Users\Kirsten\AppData\Local\Temp\build5952589283937804508.tmp\sketch_oct28b.cpp.o

In file included from sketch_oct28b.ino:6:
C:\Users\Kirsten\Documents\Arduino\libraries\Servo/Servo.h:5:20: warning: wiring.h: No such file or directory
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -IC:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\variants\standard -IC:\Users\Kirsten\Documents\Arduino\libraries\Servo -IC:\Users\Kirsten\Documents\Arduino\libraries\Servo\utility C:\Users\Kirsten\Documents\Arduino\libraries\Servo\Servo.cpp -o C:\Users\Kirsten\AppData\Local\Temp\build5952589283937804508.tmp\Servo\Servo.cpp.o

In file included from C:\Users\Kirsten\Documents\Arduino\libraries\Servo\Servo.cpp:2:
C:\Users\Kirsten\Documents\Arduino\libraries\Servo/Servo.h:5:20: warning: wiring.h: No such file or directory
C:\Users\Kirsten\Documents\Arduino\libraries\Servo\Servo.cpp: In member function ‘uint8_t Servo::attach(int)’:
C:\Users\Kirsten\Documents\Arduino\libraries\Servo\Servo.cpp:28: error: ‘digitalWrite’ was not declared in this scope
C:\Users\Kirsten\Documents\Arduino\libraries\Servo\Servo.cpp:29: error: ‘OUTPUT’ was not declared in this scope
C:\Users\Kirsten\Documents\Arduino\libraries\Servo\Servo.cpp:29: error: ‘pinMode’ was not declared in this scope
C:\Users\Kirsten\Documents\Arduino\libraries\Servo\Servo.cpp: In member function ‘void Servo::write(int)’:
C:\Users\Kirsten\Documents\Arduino\libraries\Servo\Servo.cpp:52: error: ‘clockCyclesPerMicrosecond’ was not declared in this scope
C:\Users\Kirsten\Documents\Arduino\libraries\Servo\Servo.cpp: In static member function ‘static void Servo::refresh()’:
C:\Users\Kirsten\Documents\Arduino\libraries\Servo\Servo.cpp:74: error: ‘millis’ was not declared in this scope
C:\Users\Kirsten\Documents\Arduino\libraries\Servo\Servo.cpp:107: error: ‘digitalWrite’ was not declared in this scope
C:\Users\Kirsten\Documents\Arduino\libraries\Servo\Servo.cpp:109: error: ‘TCNT0’ was not declared in this scope
C:\Users\Kirsten\Documents\Arduino\libraries\Servo\Servo.cpp:124: error: ‘digitalWrite’ was not declared in this scope

In file included from sketch_oct28b.ino:6:
C:\Users\Kirsten\Documents\Arduino\libraries\Servo/Servo.h:5:20: warning: wiring.h: No such file or directory

The servo library that comes with the IDE is not located in that directory. The Servo library that comes with the IDE does not include wiring.h. Get rid of your obsolete version.

Thanks Paul.

I am trying to use the "Sweep" example, and I thought I have the most up to date version.

Do i need to uninstall the Arduino Program (IDE) and reinstall on my PC?

Do i need to uninstall the Arduino Program (IDE) and reinstall on my PC?

No. You need to delete the copy of the Servo library from your libraries folder.

I am using this sketch… I don’t even see the “Wiring.h” library in my libraries list.

#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
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>=1; 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 wiring.h file was dropped with IDE v1.0.x. It was replaced by Arduino.h.
In the old library, Servo.h loads Servo.cpp. Servo.cpp loads WProgram.h. WProgram.h loads wiring.h
In the new library, Servo.h loads Servo.cpp. Servo.cpp loads Arduino.h.

It appears you are attempting to use a library or code from an old version of the IDE.

Paul & SurferTim,

Thanks for the help. I deleted the “old” version of Servo.h (that included Wiring.h)

I think I added the “old” version when I found a sketch online that instructed me to add the Servo.h library into my IDE. I didn’t realize that the newer version was already in the IDE.

I got it working!! Thanks again!!

You need to move the servo file(s) , probably zipped, from the C:\Users\Kirsten\Documents\Arduino\libraries\Servo directory, where they are being downloaded if 3rd party, to C:\Program Files (x86)\Arduino....\libraries
You have probably Imported the servo library form the part of the libraries list AFTER the separator. The IDE has an issue searching "regular" libraries and , I forget what they call them, the ones under the separator , mostly if they have another include files in them. .
And for safety ALWAYS check the contents of the header file you THINK you are getting.
I would suggest you "import" LiquidCrystal so you can see how libraries are actually successfully compiled , just for comparison.
You do not have to implement LCD to do this.
Good luck.
Cheers Vaclav

Since this new piece of fine work won't let me edit / delete my last post. I am glad you got it working