wonder if you can help me. I want to write an arduino sketch the check whether the pins are defined as an input or output. basically, if I set the pins like this:
int in1 = 2;
int in2 = 3;
...
...
int out1 = 10;
int out2 = 23;
...
...
... then later on in the sketch, I want to write a for loop, to go through all the pins and check whether they were defined as an inputs or outputs for example:
for (int i=2; i <= 54; i++){
if (Pins[x] == input) {
foo
}
if (Pins[x] == output {
foo1
}
}
is there a way via an IF statement to check whether the pin was defined as in or output ?
In addition I can't see what you might use the knowledge of the mode setting for. If you want a pin to have a particular mode just set it with pinMode().