I work at a motor programm (and i have to control multiple motors thats why i use the struct) together with my arduino MEGA. I dont't understand why MOTOR is out of scope when I use it as argument in the drive function:
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: error: previous declaration of 'int drive'
'MOTOR' was not declared in this scope