I am trying to write some classes (for a walking robot, but that's besides the point), and I am having some unexpected problems.
I created the following class which works fine:
class MyServo {
public:
MyServo(Servo s, int ce, int hi, int lo, bool inv);
............
};
But then I created another class which takes MyServo objects in its constructor:
class Leg {
public:
Leg(MyServo s1, MyServo s2, MyServo s3);
............
};
This didn't cause any problems either, but then I wrote the actual constructor:
Leg::Leg(MyServo s1, MyServo s2, MyServo s3) {
............
}
And this gave me the following error: "No matching function for call to MyServo::MyServo".
I tried figuring this out but I must admit I don't understand it. In particular because the MyServo constructor takes a Servo object as an argument, which to me is exactly the same situation as the Leg constructor taking a MyServo object as an argument.
Here is the entire error message:
NewCrab.ino: In constructor 'Leg::Leg(MyServo, MyServo, MyServo)':
NewCrab:130: error: no matching function for call to 'MyServo::MyServo()'
NewCrab.ino:93: note: candidates are: MyServo::MyServo(Servo, int, int, int, bool)
NewCrab.ino:78: note: MyServo::MyServo(const MyServo&)
NewCrab:130: error: no matching function for call to 'MyServo::MyServo()'
NewCrab.ino:93: note: candidates are: MyServo::MyServo(Servo, int, int, int, bool)
NewCrab.ino:78: note: MyServo::MyServo(const MyServo&)
NewCrab:130: error: no matching function for call to 'MyServo::MyServo()'
NewCrab.ino:93: note: candidates are: MyServo::MyServo(Servo, int, int, int, bool)
NewCrab.ino:78: note: MyServo::MyServo(const MyServo&)
PS: I have attached the code in an file...
NewCrab.ino (4.44 KB)