Hi
I want to use GPIOs 0 to 16 as OUTPUT except GPIO number 6, 7, 8, 9 and 11.
So I use the following piece of code.
for (int i = 0; i <= 16; i++) {
if (i != 6 && i != 7 && i != 8 && i != 9 && i != 11) {
pinMode(i, OUTPUT);
}
}
Then, I want to record the state of each of these GPIOs in a varaible called "statepinx" with x the number of each spcific GPIO.
for (int i = 0; i <= 16; i++) {
if (i != 6 && i != 7 && i != 8 && i != 9 && i != 11) {
char buf[30];
sprintf(buf, "statepin%d", i); //at first iteration, buf = statepin0
static bool *buf = 0; // so I want to create the boolean variable "statepin0" but this doesn't work as the compiler thinks I want to create a new pointer !
if ("newly_statepin_created" != digitalRead(i)) {
"newly_statepin_created" = digitalRead(i);
char buff[30];
sprintf(buff, "%s has just changed to %d", newly_statepin_created, *newly_statepin_created);
}
}
}
I hope my question isn"t too confused.