I'm trying to run an arduino program that uses a struct containing servo objects and it gives me this error:
error: 'leg' does not name a type
I think I'm doing something wrong with memory management but I'm fairly new to this so any help is appreciated.
This is my code:
#include <Servo.h> 
typedef struct{
 Servo hip;
 Servo shin;
 Servo foot;
}leg;
int currentPin = 0; //this is the pin that the leg will be attached to
leg getLeg(void){
  leg newLeg;
  newLeg.hip.attach(currentPin++);
  newLeg.shin.attach(currentPin++);
  newLeg.foot.attach(currentPin++);
  return newLeg;  
}
void setup() 
{ 
  leg frontLeft = getLeg();
  leg frontRight = getLeg();
  leg backRight = getLeg();
  leg backLeft = getLeg();
} 
void loop() 
{ 
} 
 
     
    