]> git.piffa.net Git - arduino/blob - books/beginning_c_code/Chapter08/Listing8_4/Listing8_4.ino
giov
[arduino] / books / beginning_c_code / Chapter08 / Listing8_4 / Listing8_4.ino
1 /*
2   Purpose: Display an int array using array indexes
3   Dr. Purdum, August 13, 2012
4  */
5   
6 void setup() {                
7   // So we can communicate with the PC
8   Serial.begin(9600);   
9 }
10
11 void loop() {
12   int greet[6];         // Notice this is an int now
13   int *ptr;             // ...as is this
14   int i;
15   
16   greet[0] = 0; // Numbers now...
17   greet[1] = 1;
18   greet[2] = 2;
19   greet[3] = 3;
20   greet[4] = 4;
21   greet[5] = 5;
22  
23   ptr = greet;
24   for (i = 0; i < 5; i++) {
25     Serial.print(greet[i]);
26   }
27   Serial.flush();  // Make sure all the data is sent...
28   exit(0);
29 }
30 \r