]> git.piffa.net Git - arduino/blob - books/beginning_c_code/Chapter08/Listing8_3/Listing8_3.ino
first commit
[arduino] / books / beginning_c_code / Chapter08 / Listing8_3 / Listing8_3.ino
1 /*
2   Purpose: Display a character array using array indexes
3   Dr. Purdum, August 14, 2012
4  */
5   
6 void setup() {                
7   // So we can communicate with the PC
8   Serial.begin(9600);   
9 }
10
11
12 void loop() {
13   char greet[6];
14   int i;
15   
16   greet[0] = 'H';       // Initialize the array with some characters
17   greet[1] = 'e';
18   greet[2] = 'l';
19   greet[3] = 'l';
20   greet[4] = 'o';
21   greet[5] = '\0';
22  
23   for (i = 0; i < 5; i++) {
24     Serial.print(greet[i]);
25   }
26   Serial.flush();  // Make sure all the data is sent...
27   exit(0);
28 }
29 \r