小编Cle*_*ens的帖子

Arduino - 结构超出范围的原因?

我在一个电机程序(我必须控制多个电机,这就是我使用结构的原因)和我的arduino MEGA一起工作.当我在驱动功能中使用它作为参数时,我不明白为什么MOTOR超出范围:

typedef struct motor
{
   int EN;
   /*some more ints*/
}MOTOR;

MOTOR mot1;
MOTOR mot2; /*this works with no compile error*/
int drive (MOTOR*) /*here i have compile error out of scope, neither with or without pointer*/
{
   return 1;
}

void setup()
{}

void loop()
{}


sketch_jul25a:2: error: 'MOTOR' was not declared in this scope
sketch_jul25a:2: error: expected primary-expression before ')' token
sketch_jul25a.ino: In function 'int drive(MOTOR*)':
sketch_jul25a:9: error: 'int drive(MOTOR*)' redeclared as different kind of symbol
sketch_jul25a:2: …
Run Code Online (Sandbox Code Playgroud)

c arduino

1
推荐指数
1
解决办法
687
查看次数

标签 统计

arduino ×1

c ×1