If it works, ok, but it may be clearer if it looks like this (I think it is the same thing)
for (i=0 to 7) // for each row
{
for (j = 0 to 7) // each column of osi1
process osi1[i*8 + j]
for (j = 0 to 7) // each column of osi2
process osi2[i*8 + j]
for (j = 0 to 7) // each column of osi3
process osi3[i*8 + j]
}
I’m having a real problem understanding what order it prints the arrays in.
But I think the way I would have coded this Is much as Marco_c suggests…
for (int r = 0; r < 8; r++) {
for (int c = 0; c < 8; c++) {
Serial.print(osi1.rawReading(r*8+c));
Serial.print(", ");
}
for (int c = 0; c < 8; c++) {
Serial.print(osi2.rawReading(r*8+c));
Serial.print(", ");
}
for (int c = 0; c < 8; c++) {
Serial.print(osi3.rawReading(r*8+c));
Serial.print(", ");
}
Serial.println();
}
Which I think is what you are trying to do. But like I said, very hard to untangle the while loops (especially given your unusual indenting style).
In fact you might even consider placing references to osi1…osi3 in an array, and then…
for (int r = 0; r < 8; r++) {
for (int i = 0; i < 3; i++) {
for (int c = 0; c < 8; c++) {
Serial.print(osi[i].rawReading(r*8+c));
Serial.print(", ");
}
}
Serial.println();
}
As an aside, ‘l’ is usually considered a very poor choice of variable name. In some mono-space fonts it’s very difficult to tell the difference between the digit ‘1’ and a lower case letter ‘l’:
l1l1
Also in most sans-serif fonts the capital letter ‘I’ looks almost the same as lower case ‘l’ as well:
lIlI
Im just about to try out what @marco_c sugested and clean it up a bit. It does not need to be human readable as the output is going in to somethign else. Attached is a video.
There is sensor overlap on purpose so as to eliminate any blind spot but the orientation gives me a good 160 odd degrees of coverage.
Thanks for the input guys cleaning it up like this will make life a little easier.