Ok so this has probably been asked loads before, but I am new to arduino development and have googled but cant find the answer via google
so I have my own custom library called ARM
Arm.h
#ifndef Arm_h
#define Arm_h
#include "WProgram.h"
#include "../Servo/Servo.h"
class Arm {
public:
Arm(int servoPin, int motorPin);
int getPosition();
void setPosition(int pos);
int getMotorSpeed();
void setMotorSpeed(int mSpeed);
};
#endif
and
Arm.cpp
#include "WProgram.h"
#include <Arm.h>
#include <../Servo/Servo.h>
int motorSpeed;
int servoPos;
Servo positionServo;
Arm::Arm(int servoPin, int motorPin) {
positionServo.attach(servoPin);
}
void Arm::setPosition(int pos) {
servoPos = pos;
}
void Arm::setMotorSpeed(int mSpeed) {
motorSpeed = mSpeed;
}
int Arm::getPosition() {
return servoPos;
}
int Arm::getMotorSpeed() {
return motorSpeed;
}
then i have a basic sketch that I am trying to play with to see if i can get things working
#include <Arm.h>
// the arms
Arm tester(1, 2);
void setup() {
}
void loop() {
}
which gives the following error(s)
Arm\Arm.cpp.o: In function `__static_initialization_and_destruction_0':
C:\Program Files\arduino\libraries\Arm/Arm.cpp:9: undefined reference to `Servo::Servo()'
Arm\Arm.cpp.o: In function `Arm':
C:\Program Files\arduino\libraries\Arm/Arm.cpp:12: undefined reference to `Servo::attach(int)'
my questions are
why is this?
how do i fix it?
and from previous development experience hard coding the location of Servo.h can't be good surely? if not how do I get around this issue?
my class can be imported via the arduino IDE and works fine if i omit the servo stuff, but the thing I want to make requires a few servos and motorcontrollers (trying to get servos working forst though)
Thanks
Drogo