Seems to me that by the time I got around to needing to control 18 LEDs (especially with individual brightness settings), I'd switch over to an addressable LED type -- for example WS2812B or APA102. Both are available as preassembled multi-LED strips and individual components. You could control all 18 (and many more) using one (WS2812B) or two (APA102) digital pins -- no PWM required.
The number 16 is just defined arbitrarily to be sure not so many channels are used and time wasted to check unused channels
It's easy to change to larger or smaller number by changing this line AVR_Slow_PWM_ISR.h#L142 to the number you'd like to have
For example from
#define MAX_NUMBER_CHANNELS 16
to
#define MAX_NUMBER_CHANNELS 18
also change in the example these lines ISR_8_PWMs_Array.ino#L97-L116 to match your actual connections and requirements
// You can assign pins here. Be careful to select good pin to use or crash, e.g pin 6-11
uint32_t PWM_Pin[] =
{
LED_BUILTIN, PIN_D0, PIN_D1, PIN_D2, PIN_D3, PIN_D4, PIN_D5, PIN_D6
};
#define NUMBER_ISR_PWMS ( sizeof(PWM_Pin) / sizeof(uint32_t) )
// You can assign any interval for any timer here, in Hz
uint32_t PWM_Freq[NUMBER_ISR_PWMS] =
{
1, 2, 3, 4, 5, 6, 7, 8
};
// You can assign any interval for any timer here, in Microseconds
uint32_t PWM_DutyCycle[NUMBER_ISR_PWMS] =
{
5, 10, 20, 25, 30, 35, 40, 45
};