超级noob问题,但我很难理解Arduino中的数组。我做了一堆阅读和摆弄,但我想我错过了一些核心想法。我在下面有三个问题......作为我的代码中的注释。
//Question1: Is there anyway to keep this a dynamic array length?
int arrname[20];
void setup() {
Serial.begin(9600);
}
void loop() {
//Question 2: How can I add this to the end of the array?
arrname[0] = data from sensor;
int arrsize = sizeof(arrname) / sizeof(arrname[0]);
//Question 3: Why is this not iterating through the values?
for(int i = 0; i < sizeof(valarr); i=i+1){
Serial.print(valarr[i]);
}
}
感谢您的帮助!