我正在尝试在我的 Mega 上同时为所有模拟输入引脚设置引脚模式。所以我在设置之前做了一个数组:
char* Analog_Input_List[16] = {"A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","A10","A11","A12","A13","A14","A15"};
然后我尝试运行这个:
//analogue input pin set-up
for (int i =0;i<8;i++){
pinMode(Analog_Input_List[i], OUTPUT);
}
但我收到了这个错误:
sketch_jul24a.cpp: In function ‘void setup()’:
sketch_jul24a.cpp:54:40: error: invalid conversion from ‘char*’ to ‘uint8_t’
sketch_jul24a.cpp:54:40: error: initializing argument 1 of ‘void pinMode(uint8_t, uint8_t)’
我是 arduino 编程的新手,类型的声明和操作一直让我感到困惑,我知道它很简单,但不知道如何修复它。
谢谢