Open spairo1741 opened 2 years ago
I think it is quite tricky to come up with an efficient generic solution that works on all platforms. I suggest that you just implement your own subclass of PinReader. There you could handle all the necessary bit shift operations...
Pin 18 -> 1 => OK Pin 19 -> 10 => OK Pin 21 -> 1000 => OK Pin 22 -> 10000 => OK Pin 23 -> 100000 => OK Pin 25 -> 10000000 => OK Pin 26 -> 0 => ERROR Pin 27 -> 0 => ERROR
int arr[] = {18, 19, 21, 22, 23, 25, 26, 27}; // free pins for esp32 Wroom 32 ... for(int pin : arr) { //for (int pin = pinStart; pin < pinStart + numberOfPins; pin++) { pinMode(pin, OUTPUT); digitalWrite(pin, HIGH); ... }