Hi Again,
How would i do this for a multidimensional array?
I have this:
for (int i = 0; i < 8; i++)
{
if (AlarmAddress[1][i] == 1)
Serial.print(AlarmAddress[0][i]);
if(i != 8 - 1)
{
Serial.print(",");
}
else
{
Serial.println();
}
}
septillion:
Alrigh, what's the problem? If you really want comma seperated instead of new line seperated you just do:#define numberof(x) (sizeof(x)/sizeof(x[0]))
int numbers[8] = {34, 35, 36, 37, 38, 39, 40, 41}; //any reason for it being int instead of byte?
void setup()
{
Serial.begin(9600);
}
void loop()
{
for (byte i = 0; i < numberof(numbers); i++)
{
Serial.print(numbers[i]);
//if not last number, add a comma
if(i != (numberof(numbers) - 1))
{
Serial.print(",");
}
//and a new line after all numbers`
else
{
Serial.println();
}
}
delay(1000);
}
Thanks Again