Errors Installing External Libraries (MegaServo, ServoTimer2 , SoftwareServo)

Hey All,

I've been having issues installing the MegaServo external library....I keep getting no such file or directory errors.

Here's what I've tried: 1) Unzipped MegaServo.zip and placed the directory here: Contents\Resources\Java\Libraries (this is where I've installed the WavHC library without issues) 2) Restarted Arduino IDE

Next I tried installing the extracted folder here: 1) Documents -> Arduino -> libraries 2) Restarted Arduino IDE

Here is the same error I get:

/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:56:23: error: WProgram.h: No such file or directory
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp: In function 'void handle_interrupts(servoTimer_t, volatile uint16_t*, volatile uint16_t*)':
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:96: error: 'LOW' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:96: error: 'digitalWrite' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:103: error: 'HIGH' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:103: error: 'digitalWrite' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:107: error: 'clockCyclesPerMicrosecond' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp: At global scope:
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:169: error: 'boolean' does not name a type
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp: In constructor 'MegaServo::MegaServo()':
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:205: error: 'clockCyclesPerMicrosecond' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp: In member function 'uint8_t MegaServo::attach(int, int, int)':
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:219: error: 'OUTPUT' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:219: error: 'pinMode' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:226: error: 'isTimerActive' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp: In member function 'void MegaServo::write(int)':
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:247: error: 'byte' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:247: error: expected `;' before 'channel'
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:248: error: 'channel' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:251: error: 'map' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:258: error: 'clockCyclesPerMicrosecond' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp: In member function 'int MegaServo::read()':
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:273: error: 'map' was not declared in this scope
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp: In member function 'int MegaServo::readMicroseconds()':
/Users/smjohn/Documents/Arduino/libraries/MegaServo/MegaServo.cpp:280: error: 'clockCyclesPerMicrosecond' was not declared in this scope

I'm getting similar library installation errors with ServoTimer2 and SoftwareServo.

It's strange also then when I go to the Import Library drop down menu, I can see MegaServo, ServoTimer2 and Software Servo available as contributed libraries.

Any ideas what I'm doing wrong here?

Any ideas what I'm doing wrong here?

For a start, you don't seem to have done any research into the first error on your list:

error: WProgram.h: No such file or directory

The search box at the top right corner of every page is very useful. I recommend giving it a try. As this problem has been posted about every few days since IDE 1.0 was released, there are plenty of responses to help you.

This is from the IDE 1.0 release notes, which presumably you read when you downloaded the IDE:

The WProgram.h file, which provides declarations for the Arduino API, has been renamed to Arduino.h. To create a library that will work in both Arduino 0022 and Arduino 1.0, you can use an #ifdef that checks for the ARDUINO constant, which was 22 and is now 100. For example:

if defined(ARDUINO) && ARDUINO >= 100

include "Arduino.h"

else

include "WProgram.h"

endif

BTW: this - Contents\Resources\Java\Libraries - is not the place to put downloaded libraries.

Hello…I am using an arduino uno with a adafruit wav shield. I got a conflict with the serv.ccp and waveHC.ccp over using Timer1. I am trying to work around by using ServoTimer2 but with the simplest sketch I get these errors:

sketch_may14b.cpp.o: In function __static_initialization_and_destruction_0': C:\Users\cappy\AppData\Local\Temp\build987738042993949936.tmp/sketch_may14b.cpp:7: undefined reference to ServoTimer2::ServoTimer2()’
C:\Users\cappy\AppData\Local\Temp\build987738042993949936.tmp/sketch_may14b.cpp:8: undefined reference to ServoTimer2::ServoTimer2()' sketch_may14b.cpp.o: In function loop’:
C:\Users\cappy\AppData\Local\Temp\build987738042993949936.tmp/sketch_may14b.cpp:19: undefined reference to ServoTimer2::write(int)' C:\Users\cappy\AppData\Local\Temp\build987738042993949936.tmp/sketch_may14b.cpp:21: undefined reference to ServoTimer2::write(int)’
C:\Users\cappy\AppData\Local\Temp\build987738042993949936.tmp/sketch_may14b.cpp:24: undefined reference to ServoTimer2::write(int)' C:\Users\cappy\AppData\Local\Temp\build987738042993949936.tmp/sketch_may14b.cpp:26: undefined reference to ServoTimer2::write(int)’
sketch_may14b.cpp.o: In function setup': C:\Users\cappy\AppData\Local\Temp\build987738042993949936.tmp/sketch_may14b.cpp:12: undefined reference to ServoTimer2::attach(int)’
C:\Users\cappy\AppData\Local\Temp\build987738042993949936.tmp/sketch_may14b.cpp:13: undefined reference to `ServoTimer2::attach(int)’

The code is as follows:

#include <ServoTimer2.h>  // the servo library

ServoTimer2 a;
ServoTimer2 b;

void setup()
{
   a.attach(5);
   b.attach(6);
}

void loop()
{
  a.write(2000);
  delay(500);
  a.write(1000);
  delay(500);
  
  b.write(2000);
  delay(5000);
  b.write(1000);
  delay(500);
}

I have found several versions of ServoTimer2 here and at the Adafruit forum. None of them are working for me. Please advise!

Thank you!!

Cappy Jack