user19667: Bear with me as I'm fairly adept at C# but I am having a problem understanding how to get an array iterated.
I am writing a program to test relay boards, it will eventually have an input mechanism to select the number of relays on the board. For now, i just need to get an array iterated to move on with the code.
The biggest relay board I've seen has 16 relays, so....
#define Relay1  2  // Arduino Digital I/O pin numbers for UNO R3
#define Relay2  3
#define Relay3  4
#define Relay4  5
#define Relay5  7  
#define Relay6  8
#define Relay7  9
#define Relay8  10
#define Relay9  11  
#define Relay10  12
#define Relay11  13
#define Relay12  A0
#define Relay13  A1 
#define Relay14  A2
#define Relay15  A3
#define Relay16  A4

int relays[]{ Relay1,Relay2,Relay3,Relay4,
    Relay5,Relay6,Relay7,Relay8 };
int maxRelayCount = 8;
char rx_byte = 0;

void setup()   //Initializes all variables and settings
{
  Serial.begin(9600);
 // create an input for the amount of relays on the board
//hardcoded for now

//Set pins to OFF & declare pins as OUTPUTS
 for(int i = 0; i < maxRelayCount; i++)
 {
   digitalWrite(relays[i], RELAY_OFF);
   pinMode(relays[i], OUTPUT);
   //How to convert i to a string in c++?
   //Serial.print("Relay " +[i] + " set HIGH and as OUTPUTS");
 }

 //Check that all relays are inactive at Reset
 delay(4000); 

}

So there are two issues. If I remove the loop and just hard code 8 times to set HIGH and OUTPUT it works fine, but the loop does not and won't upload to the Arduino, thus the reason I believe it is wrong. Secondary question is how to convert the counter i to a string to concatenate the message

user3917: As noted earlier, RELAY_OFF needs a defined value.  
Note, rather than using clumsy list of #define statements to define a bunch of integer constants, you can use C's enum declaration to define them, as shown in the following sketch, which produces the output
Relay 1 should be OFF
Relay 2 should be OFF
Relay 3 should be OFF
Relay 4 should be OFF
Relay 5 should be OFF
Relay 6 should be OFF
Relay 7 should be OFF
Relay 8 should be OFF

when it is run.
#include <Streaming.h>

// Arduino Digital I/O pin numbers for UNO R3
enum { Relay1=2, Relay2=3, Relay3=4, Relay4=5, Relay5=7, Relay6=8,
       Relay7=9,   Relay8=10,  Relay9=11,  Relay10=12,  Relay11=13,
       Relay12=A0, Relay13=A1, Relay14=A2, Relay15=A3,  Relay16=A4};

int relays[] = {Relay1,Relay2,Relay3,Relay4,Relay5,Relay6,Relay7,Relay8};
// Number of relays in the array
enum { maxRelayCount = sizeof relays / sizeof relays[0] };
enum { RELAY_OFF = HIGH };  // Set LOW or HIGH as appropriate
char rx_byte = 0;

void setup() {          // Initialize variables and settings
  Serial.begin(9600);
  //Set pins to OFF & declare pins as OUTPUTS
  for(int i = 0; i < maxRelayCount; ++i) {
    digitalWrite(relays[i], RELAY_OFF);
    pinMode(relays[i], OUTPUT);
    // Serial.print("Relay " +[i] + " set HIGH and as OUTPUTS");
    Serial << "Relay " << i+1 << " should be OFF" << endl;
  }

 // Check that all relays are inactive at Reset
 delay(4000);
}

void loop() {}

Note, the Streaming.h library adds some “syntactic sugar” to Arduino C. At compile time it converts C++-like << Serial stream operators to Serial.print statements, without increasing code size.  You can install it by unzipping Streaming5.zip from arduiniana.org in your sketchbook/libraries directory.

user4143: 
the loop does not and won't upload to the Arduino

Most likely because RELAY_OFF has never been defined anywhere. Change that to HIGH (if that is what your relays need to turn off), or define it somewhere.
Also there is no loop() function - is that just you being economical with the paste?

Secondary question is how to convert the counter i to a string to concatenate the message.

Simple: don't.  There's no need.
Serial.print("Relay ");
Serial.print(i);
Serial.println(" set HIGH and as OUTPUT");


19667: <p>Bear with me as I'm fairly adept at C# but I am having a problem understanding how to get an array iterated.</p>

<p>I am writing a program to test relay boards, it will eventually have an input mechanism to select the number of relays on the board. For now, i just need to get an array iterated to move on with the code.</p>

<p>The biggest relay board I've seen has 16 relays, so....</p>

<pre><code>#define Relay1  2  // Arduino Digital I/O pin numbers for UNO R3
#define Relay2  3
#define Relay3  4
#define Relay4  5
#define Relay5  7  
#define Relay6  8
#define Relay7  9
#define Relay8  10
#define Relay9  11  
#define Relay10  12
#define Relay11  13
#define Relay12  A0
#define Relay13  A1 
#define Relay14  A2
#define Relay15  A3
#define Relay16  A4

int relays[]{ Relay1,Relay2,Relay3,Relay4,
    Relay5,Relay6,Relay7,Relay8 };
int maxRelayCount = 8;
char rx_byte = 0;

void setup()   //Initializes all variables and settings
{
  Serial.begin(9600);
 // create an input for the amount of relays on the board
//hardcoded for now

//Set pins to OFF &amp; declare pins as OUTPUTS
 for(int i = 0; i &lt; maxRelayCount; i++)
 {
   digitalWrite(relays[i], RELAY_OFF);
   pinMode(relays[i], OUTPUT);
   //How to convert i to a string in c++?
   //Serial.print("Relay " +[i] + " set HIGH and as OUTPUTS");
 }

 //Check that all relays are inactive at Reset
 delay(4000); 

}
</code></pre>

<p>So there are two issues. If I remove the loop and just hard code 8 times to set HIGH and OUTPUT it works fine, but the loop does not and won't upload to the Arduino, thus the reason I believe it is wrong. Secondary question is how to convert the counter i to a string to concatenate the message</p>
 3917: <p>As noted earlier, <code>RELAY_OFF</code> needs a defined value.  </p>

<p>Note, rather than using clumsy list of <code>#define</code> statements to define a bunch of integer constants, you can use C's <code>enum</code> declaration to define them, as shown in the following sketch, which produces the output</p>

<pre><code>Relay 1 should be OFF
Relay 2 should be OFF
Relay 3 should be OFF
Relay 4 should be OFF
Relay 5 should be OFF
Relay 6 should be OFF
Relay 7 should be OFF
Relay 8 should be OFF
</code></pre>

<p>when it is run.</p>

<pre class="lang-c prettyprint-override"><code>#include &lt;Streaming.h&gt;

// Arduino Digital I/O pin numbers for UNO R3
enum { Relay1=2, Relay2=3, Relay3=4, Relay4=5, Relay5=7, Relay6=8,
       Relay7=9,   Relay8=10,  Relay9=11,  Relay10=12,  Relay11=13,
       Relay12=A0, Relay13=A1, Relay14=A2, Relay15=A3,  Relay16=A4};

int relays[] = {Relay1,Relay2,Relay3,Relay4,Relay5,Relay6,Relay7,Relay8};
// Number of relays in the array
enum { maxRelayCount = sizeof relays / sizeof relays[0] };
enum { RELAY_OFF = HIGH };  // Set LOW or HIGH as appropriate
char rx_byte = 0;

void setup() {          // Initialize variables and settings
  Serial.begin(9600);
  //Set pins to OFF &amp; declare pins as OUTPUTS
  for(int i = 0; i &lt; maxRelayCount; ++i) {
    digitalWrite(relays[i], RELAY_OFF);
    pinMode(relays[i], OUTPUT);
    // Serial.print("Relay " +[i] + " set HIGH and as OUTPUTS");
    Serial &lt;&lt; "Relay " &lt;&lt; i+1 &lt;&lt; " should be OFF" &lt;&lt; endl;
  }

 // Check that all relays are inactive at Reset
 delay(4000);
}

void loop() {}
</code></pre>

<p>Note, the <code>Streaming.h</code> library adds some “syntactic sugar” to Arduino C. At compile time it converts C++-like &lt;&lt; Serial stream operators to Serial.print statements, without increasing code size.  You can install it by unzipping <a href="http://arduiniana.org/Streaming/Streaming5.zip" rel="nofollow noreferrer"><code>Streaming5.zip</code></a> from <a href="http://arduiniana.org/libraries/streaming/" rel="nofollow noreferrer">arduiniana.org</a> in your <code>sketchbook/libraries</code> directory<a href="https://arduino.stackexchange.com/questions/18348/arduino-variable-data-type">.</a></p>
 4143: <blockquote>
  <p>the loop does not and won't upload to the Arduino</p>
</blockquote>

<p>Most likely because <code>RELAY_OFF</code> has never been defined anywhere. Change that to HIGH (if that is what your relays need to turn off), or define it somewhere.</p>

<p>Also there is no <code>loop()</code> function - is that just you being economical with the paste?</p>

<blockquote>
  <p>Secondary question is how to convert the counter i to a string to concatenate the message.</p>
</blockquote>

<p>Simple: don't.  There's no need.</p>

<pre><code>Serial.print("Relay ");
Serial.print(i);
Serial.println(" set HIGH and as OUTPUT");
</code></pre>
