Pages: [1]   Go Down
Author Topic: Arduino MegaServo library doesn't work  (Read 1752 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Arduino MegaServo library doesn't work.
I downloaded the MegaServo library from http://playground.arduino.cc/Code/MegaServo  in arduino-1.0.1\libraries\MegaServo if I add the library shows this errors.
Why?

Quote
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp: In function 'void handle_interrupts(servoTimer_t, volatile uint16_t*, volatile uint16_t*)':
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:96: error: 'LOW' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:96: error: 'digitalWrite' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:103: error: 'HIGH' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:103: error: 'digitalWrite' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:107: error: 'clockCyclesPerMicrosecond' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp: At global scope:
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:169: error: 'boolean' does not name a type
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp: In constructor 'MegaServo::MegaServo()':
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:205: error: 'clockCyclesPerMicrosecond' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp: In member function 'uint8_t MegaServo::attach(int, int, int)':
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:219: error: 'OUTPUT' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:219: error: 'pinMode' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:226: error: 'isTimerActive' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp: In member function 'void MegaServo::write(int)':
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:247: error: 'byte' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:247: error: expected `;' before 'channel'
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:248: error: 'channel' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:251: error: 'map' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:258: error: 'clockCyclesPerMicrosecond' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp: In member function 'int MegaServo::read()':
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:273: error: 'map' was not declared in this scope
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp: In member function 'int MegaServo::readMicroseconds()':
D:\Program Files\arduino-1.0.1\libraries\MegaServo\MegaServo.cpp:280: error: 'clockCyclesPerMicrosecond' was not declared in this scope
« Last Edit: February 16, 2013, 09:32:25 am by SpaceOne » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48569
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I downloaded the MegaServo library in arduino-1.0.1\libraries\MegaServo if I add the library shows this errors.
The folder you put the code in is for core libraries. MegaServo is NOT a core library. Put it where it belongs, in the libraries folder of your sketch directory.

A link to where you downloaded from would be useful, too, for people that understand how to download and install libraries properly to reproduce the problem, if any.

I'd guess, though, that the library has not been upgraded for use on 1.0+.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You are right, I  put the MegaServo library in the sketch directory. 

MegaServo library wasn't updated for the new IDE 1. But I replaced in MegaServo.cpp  #include <WProgram.h> with  #include <Arduino.h> and it compiles.
Logged

Belgium
Offline Offline
Sr. Member
****
Karma: 1
Posts: 281
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You don't need to install this library if you are using Arduino 0017 or higher... It's included in the Arduino IDE and renamed to servo.h.
http://playground.arduino.cc/Code/MegaServo

Quote
The library (renamed to Servo) is distributed with Arduino releases from 0017, see the Arduino servo library reference for details. You already have this code if you are using the servo library from release 0017 or later.
Logged


Pages: [1]   Go Up
Jump to: