"타입의 이름이없는"아두 이노 서보 구조체 나는 서보 객체를 포함하는 구조체를 사용하는 아두 이노 프로그램을 실행하기 위해 노력하고있어 그것은 나에게이 오류 제공
error: 'leg' does not name a type
내가 뭔가를하고 있다고 생각을 메모리 관리에 문제가 있지만 상당히 익숙하므로 도움이 필요합니다.
이 내 코드입니다 :
#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()
{
}
'struct_Name'은 어디에 표시됩니까? – laifjei
나는 오류를 일반화하려고 시도 했었지만 지금은 분명해야한다. – Jordan