[英]typedef struct on Arduino : variable does not name a type
我想在arduino mega上为20个传感器制作一个typedef struct
(或者类似的,如果我不能),但是我有一个错误,我不明白为什么。 是来自arduino编译还是来自我的代码? 您是否认为我必须将代码放在头文件中?
typedef struct {
char nom[8];
int pin;
int onOff;
int pente;
int offset;
int maximun;
int minimum;
int constante1;
int constante2;
int hyst1;
int hyst2;
float moyenne;
float valeurs[];
int frequence;
} structSondes;
structSondes sondes[20];
structSondes test;
sondes[0].pin=1;
test.pin=1;
我在编译时遇到此错误:
错误:“探空仪”未命名类型
错误:“测试”未命名类型
您尚未提供完整的代码,因此只能猜测。
我怀疑问题在于这些陈述:
sondes[0].pin=1;
test.pin=1;
是写在ino文件的主体中,而不是在函数内部。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.