Compile error for SoftwareServo.h

Hi, I download the SoftwareServo.zip file from : http://www.arduino.cc/playground/ComponentLib/servo/

and put it in my ver.1.01 related lib folder.. When compile(Just use there example code -- SerialServo.pde), it shows below :


C:\arduino-1.0.1\libraries\SoftwareServo\SoftwareServo.cpp: In member function 'uint8_t SoftwareServo::attach(int)': C:\arduino-1.0.1\libraries\SoftwareServo\SoftwareServo.cpp:27: error: 'digitalWrite' was not declared in this scope C:\arduino-1.0.1\libraries\SoftwareServo\SoftwareServo.cpp:28: error: 'OUTPUT' was not declared in this scope C:\arduino-1.0.1\libraries\SoftwareServo\SoftwareServo.cpp:28: error: 'pinMode' was not declared in this scope C:\arduino-1.0.1\libraries\SoftwareServo\SoftwareServo.cpp: In member function 'void SoftwareServo::write(int)': C:\arduino-1.0.1\libraries\SoftwareServo\SoftwareServo.cpp:51: error: 'clockCyclesPerMicrosecond' was not declared in this scope C:\arduino-1.0.1\libraries\SoftwareServo\SoftwareServo.cpp: In static member function 'static void SoftwareServo::refresh()': C:\arduino-1.0.1\libraries\SoftwareServo\SoftwareServo.cpp:73: error: 'millis' was not declared in this scope C:\arduino-1.0.1\libraries\SoftwareServo\SoftwareServo.cpp:106: error: 'digitalWrite' was not declared in this scope C:\arduino-1.0.1\libraries\SoftwareServo\SoftwareServo.cpp:108: error: 'TCNT0' was not declared in this scope

C:\arduino-1.0.1\libraries\SoftwareServo\SoftwareServo.cpp:123: error: 'digitalWrite' was not declared in this scope

Is there any mistake or solution? Thanks~

That library is not compatible with IDE 1.0+.

In SoftwareServo.h, This:

#include <WProgram.h>

Needs replacing with:

#include "Arduino.h"

Unfortunately, due to a rather odd change in IDE 1.0.1, you don’t get the important error message that was present in 1.0.

Is there some reason why you want to use SoftwareServo, rather than the supplied, timer based, Servo library?

Hello,

I have the same problem here. I tried only to compile the “knob” exemple (with the supplied Servo library), and got similar compliation erros, with some slight differences however.

In file included from D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino\SoftwareServo.cpp:1:
D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino/SoftwareServo.h:4:22: warning: WProgram.h: No such file or directory
D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino\SoftwareServo.cpp: In member function 'uint8_t SoftwareServo::attach(int)':
D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino\SoftwareServo.cpp:27: error: 'digitalWrite' was not declared in this scope
D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino\SoftwareServo.cpp:28: error: 'OUTPUT' was not declared in this scope
D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino\SoftwareServo.cpp:28: error: 'pinMode' was not declared in this scope
D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino\SoftwareServo.cpp: In member function 'void SoftwareServo::write(int)':
D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino\SoftwareServo.cpp:51: error: 'clockCyclesPerMicrosecond' was not declared in this scope
D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino\SoftwareServo.cpp: In static member function 'static void SoftwareServo::refresh()':
D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino\SoftwareServo.cpp:73: error: 'millis' was not declared in this scope
D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino\SoftwareServo.cpp:106: error: 'digitalWrite' was not declared in this scope
D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino\SoftwareServo.cpp:108: error: 'TCNT0' was not declared in this scope
D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino\SoftwareServo.cpp:123: error: 'digitalWrite' was not declared in this scope

Adding #include<WProgram.h>
or #include "Arduino.h"
didn’t solve my problem.

In file included from D:\Fichiers executables\Arduino-1.0.1\hardware\arduino\cores\arduino\SoftwareServo.cpp:1:

This is what the knob example looks like in my copy of the IDE:

// Controlling a servo position using a potentiometer (variable resistor) 
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott> 

#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
 
int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin 
 
void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
} 
 
void loop() 
{ 
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023) 
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
  myservo.write(val);                  // sets the servo position according to the scaled value 
  delay(15);                           // waits for the servo to get there 
}

It doesn’t use SoftwareServo. Why does yours?

Making the change in reply #1 allows the SoftwareSerial example (SerialServo.pde) to compile cleanly in IDE 1.0.1.

I deleted these files form the cores/arduino folder and it works now. Thank you very much, my friend !

Have a nice day.

Hallo zusammen

Hab mir einen EggBot gebaut hab aber den gleichen Fehler wie bei Euch. “Fehler beim Kompilieren”

C:\Users\Bogdan\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp: In member function ‘uint8_t SoftwareServo::attach(int)’:
C:\Users\Bogdan\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:27: error: ‘digitalWrite’ was not declared in this scope
C:\Users\Bogdan\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:28: error: ‘OUTPUT’ was not declared in this scope
C:\Users\Bogdan\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:28: error: ‘pinMode’ was not declared in this scope
C:\Users\Bogdan\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp: In member function ‘void SoftwareServo::write(int)’:
C:\Users\Bogdan\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:51: error: ‘clockCyclesPerMicrosecond’ was not declared in this scope
C:\Users\Bogdan\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp: In static member function ‘static void SoftwareServo::refresh()’:
C:\Users\Bogdan\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:73: error: ‘millis’ was not declared in this scope
C:\Users\Bogdan\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:106: error: ‘digitalWrite’ was not declared in this scope
C:\Users\Bogdan\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:108: error: ‘TCNT0’ was not declared in this scope
C:\Users\Bogdan\Documents\Arduino\libraries\SoftwareServo\SoftwareServo.cpp:123: error: ‘digitalWrite’ was not declared in this scope

Hab den “SoftwareServo.zip” aus : http://www.arduino.cc/playground/ComponentLib/Servo runtergeladen.
Hab das # Include <WProgram.h> im SoftwareServo nicht gefunden.
Kann mir jemand helfen.
LG. Bernd.

<SoftwareSerial.h> is not working…same is happening with <Adafruit_Fingerprint.h>…Not working
what should i do…?