difficult IC pinouts

Sometimes I will be using an IC with a difficult pinout… for example, a 16-channel LED driver IC where the order of the channel pins isn’t the same order as the LEDs are lined up in.

Generally I will create an array as follows:

byte LEDPin[] = {14, 11, 5, 2, 6, 3, 12, 18, 13, 7, 8, 9, 4, 10, 16, 15};

and when I want to call to light the 7th LED up I will just call upon LEDPin[7].
Is this the best/simplest way of remapping pins for difficult ICs? Can you suggest any other ways?


Depending on how you are accessing the LEDs, you could just use #define


#define LED7 13
// etc

But the array method may be more appropriate depending if you need to access the LEDs sequentially

Btw, LEDpin[7]. Is the eighth element in the array as the first element is index zero