Trying to use VarSpeedServo, but won't compile for arduino nano

So I haven't encountered this before, but I'm trying to use VarSpeedServo in lieu of Servo.h.

My code verifies but when uploading says it won't compile for arduino nano. I havent changed any setting and indeed if I load blink (or anything) in another window it loads to this same board just fine. I had been operating under the assumption that a library compatible with arduino uno would also be compatible with a nano- is that wrong? The text from the status window relays the following (excerpt):
C:\Users\saluk\Documents\Arduino\libraries\VarSpeedServo" "C:\Users\saluk\Documents\Arduino\libraries\VarSpeedServo\VarSpeedServo.cpp" -o nul
Alternatives for WProgram.h: []C:\Users\saluk\Documents\Arduino\libraries\VarSpeedServo\VarSpeedServo.cpp:56:10: fatal error: WProgram.h: No such file or directory

ResolveLibrary(WProgram.h) #include <WProgram.h>

-> candidates: [] ^~~~~~~~~~~~

compilation terminated.
Using library VarSpeedServo in folder: C:\Users\saluk\Documents\Arduino\libraries\VarSpeedServo (legacy)
exit status 1
Error compiling for board Arduino Nano.

here's my code:

 *  Elbow(3):
 *  Zero = max elbow bend upward
 *  Wavehand(5):  160- approximate max extension
 *  60- approximate max retraction
 *  Head(9): 
 *  0-180 deg
 *  creephand = 2
 *  VarspeedServo is just like #Servo but you can use:
 *  myServo.attach (mainPin, ServoMin, ServoMax);
 *  myServo.slowmove (newpos, speed);
 *  0 = full speed 1= slowest to range 255, but 127 was this guys fastest observed.

#include <VarSpeedServo.h>
VarSpeedServo headservo;
VarSpeedServo elbowservo;
VarSpeedServo handservo;

int pos = 105; //set initial servo position
int Sensor = 7;   //Input Pin
int LED = 13;     // Led pin for Indication
int flg;
void setup() {
  headservo.attach(9);  // syntax: myServo.attach (mainPin, ServoMin, ServoMax);
  pinMode (Sensor, INPUT);  //Define Pin as input
  pinMode (LED, OUTPUT);    //Led as OUTPUT
  Serial.println("Waiting for motion");

void loop() {
     int val = digitalRead(Sensor); //Read Pin as input
     if((val > 0) && (flg==0))
        digitalWrite(LED, HIGH);
        Serial.println("Motion Detected");
        flg = 1; headservo.slowmove(158,1);

     if(val == 0)
        digitalWrite(LED, LOW);
        flg = 0; headservo.slowmove (77, 1);

Thanks for any help! **Also, my goal was to simplify servo speed adjustments in coding which I will use often. If anyone has an alternative library suggestion or method that would be great too.

Are you sure you have the most recent version?

Of Arduino IDE or varspeedservo? I just installed the later about an hour ago so probably but I can double check.

@salukikev, your topic has been moved to a more suitable location on the forum as it has nothing to do with Avrdude, stk500 or Bootloader

WProgram.h was used in early versions of the IDE; hence @anon73444976's question if you had the latest version of the library.

You can solve you problem by editing the library files with a normal editor (e.g. vi, notepad++) and replace all instances of WProgram.h by Arduino.h.

The details of the problem still aren't clear to me but this seems to be the right answer. I had two copies of that library- the one (zip) the author posted to this forum, and the other I got off github. The former was getting loaded and after deleting it the later was used and worked. thanks!

Thanks- maybe I mis-clicked the header. Sorry!

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