2 for loops into array maybe 2-dimentionel


I need help with this understanding about arrays and loops.

All I won is to loop throgh analogpins a0-a5 into a array

And the same with D2-D8 into array

Now I got 2 arrays

When I print it sholud be like tihs ex:

a0 100,a1 100, a2 100.... and so D2 1, D3 1, D4 1....

One long string.

How to do that and how to get it out again.

I have been trying with something like this.

AnalogPins[thisPin][] = (String)"A" + thisPin + "," + sensorReading;

Am I on the right way?

Print one long string of readings:

Serial.print("a0 ");
Serial.print(", a1 ");

Thanks for your answer.

Would that be the best solution, I think it will take a lot of code. instead of use for loops.

But I will go for your solution, thanks.

There are many ways to solve that problem. Arrays are fine, but a major issue with this sort of approach

AnalogPins[thisPin][] = (String)"A" + thisPin + "," + sensorReading;

is that the Arduino will probably crash after a while, due memory problems.

For this reason, most people on this forum don't recommend use of String objects with Arduino.