In this video lesson we introduce the concept of Arduino Arrays, and illustrate by writing a simple program which inputs and prints a list of grades. The code from the video above is presented below for your convenience.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29  | float grades[25]; int numGrades; int i; String myPrompt; void setup() {   // put your setup code here, to run once:   Serial.begin(9600); } void loop() {   // put your main code here, to run repeatedly:   Serial.println("How Many Grades? ");   while (Serial.available() == 0) {   }   numGrades = Serial.parseInt();   for (i = 0; i < numGrades; i = i + 1) {     myPrompt = "Please Input Grade: "+String(i+1);     Serial.println(myPrompt);     while (Serial.available()==0){     }     grades[i]=Serial.parseFloat();   }   Serial.println();   Serial.println("Your Grades Are: ");   for (i=0;i<numGrades;i=i+1){     Serial.println(grades[i]);   }   for (i=0;i<numGrades;i=i+1){   } }  |