如何将循环编号[x]附加到变量名[Var]
所有[int Val]已经从之前的代码中填充。
for (int x = 1; x <= 3; x++)
if (Val[x] > 3){
Serial.println("Do something");
}
}
答案 0 :(得分:0)
Got my reply from the Arduino forum.
I put the values into an array then used the following code:
for (int x = 0; x < (sizeof(Val) / sizeof(Val[0])); x++) {
if (Val [i] > 3){
Serial.println("Do something");
}
}