本文介绍了将“int"分配给“int [2]"时的类型不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Arduino 中我有一个错误.
In Arduino I have an error.
将‘int’赋值给‘int [2]’的类型不兼容
long received;
long received_t;
long received_m;
int arra[2];
void setup() {
analogReference(INTERNAL);
Serial.begin(9600);
}
void loop() {
while( Serial.available() > 0) {
arra = Serial.read();
Serial.println(arra[0]);
Serial.println(arra[1]);
}
}
推荐答案
怎么样
while( Serial.available() > 1) {
arra[0] = Serial.read();
arra[1] = Serial.read();
Serial.println(arra[0]);
Serial.println(arra[1]);
}
?
仍然不是好的代码,但至少应该编译.
Still not good code, but should at least compile.
这篇关于将“int"分配给“int [2]"时的类型不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!