How can I pre-dim several PWM’ed outputs at once? ("night mode")

Hi there.

I have built a special display of five reasonably bright LEDs, driven by the Core’s PWM ports and five transistors. All is well, except the LEDs and their PWM’d patterns (fading, etc.) are too bright at night.

I am looking to switch the LEDs to a much lower brightness at night, while preserving the PWM patterns themselves. This should be done for all LEDs at once, I do not want individual control. Can I use one extra digital port to toggle between a normal wire and an extra resistor or potentiometer? Is this the way to go? If so, how can I do this? Any help is greatly appreciated.

Note: I have tried to scale brightness in software, but then I’ll lose the full spectrum (255 values) of the PWM scale, and the last value before 0 is too bright as well (by the way: why?)

I would have two ranges that I use, in day mode and night mode.

Is sounds like you are manipulating your output over the entire range of Zero to 255 in day mode. You have to find a way to map that output to a less Brite max.

Posting your code may allow folks to offer you a direction.

1 Like

Personality I chose to use the HSI spectrum since that allows for individual control of hue and brightness, which seems what you’re after. Might be worthwhile looking into, and might even make certain animations easier :smile: