I am sequentially setting a number of pins on the arduino, and need help to try and write some code. Is is possible to put a variable into the name of a variable, or something like it.
The algorithm I’m shooting for is something like:
setup:
Create variables pin1, pin2, pin3 etc, set them to output.
boolean condition; // a high or low.
Loop:
for (i=1,i<7;i++){
set condition based on some criteria
digitalWrite(pini, condition);
//where i is substituted with the loop count, setting
// pin1, pin2 etc.
}
So in other words, iterate through the variable names as well as the values that they take on? Is there some smart(er) way to do this?