Heya,
I just started using an old Arduino Decimila that my friend leant to me. I am trying to remember some of my old programing but for the life of me can't figure out why this class definition isn't working. I was wondering if someone could help?
The code and the error message are bellow. Any ideas?
Cheers,
David
ERROR:
sketch_mar18a:66: error: expected
}' at end of input sketch_mar18a.cpp: In member function 'int Leg::getS0()': sketch_mar18a:18: error: expected primary-expression before ')' token sketch_mar18a:18: error: expected
;' before ')' token
sketch_mar18a:66: error: expected `}' at end of input
sketch_mar18a.cpp: At global scope:
sketch_mar18a:66: error: expected unqualified-id at end of input
CODE:
#include <Servo.h>
class Leg
{
private:
int s0;
int s1;
int d0;
int d1;Leg() {};
public:
Leg(int inputS0, int inputS1);void setS0(int inputS0);
void setS1(int inputS1);int getS0() {return s0;)
int getS1() {return s1;)
int getD0() {return d0;)
int getD1() {return d1;)
};Leg::Leg(int inputS0, int inputS10)
{
d0 = 138;
d1 = 58;
setS0(inputS0);
setS1(inputS1);void Leg::setS0(int inputS0)
{
if (inputS0 > 180) inputS0 = 180;
if (inputS0 < 0) inputS0 = 0;
s0 = inputS0;
}void Leg:setS1(int inputS1)
{
if (inputS1 > 135) inputS1 = 135;
if (inputS1 < 0) inputS1 = 0;
s1 = inputS1;
}Servo servo0;
Servo servo1;
int lowerLimit = 540; // 0 degrees at 540 microsecs with 0 degs tollerance
int upperLimit = 2360; //180 degrees at 2360 microsecs with 0 degs tolleranceLeg leg0;
void setup()
{
servo0.attach(0,lowerLimit, upperLimit);
servo1.attach(1,lowerLimit, upperLimit);
}void loop()
{
leg0.setS0(0);
leg0.setS1(0);
servo0.write(getS0());
servo1.write(180 - getS1());
delay(1000);
}