Dealing with inverted outputs on Tiny 2040

I spent a lot of time searching for a neat way to deal with the active low outputs to the Tiny 2040 RGB LED. Here it is:

from machine import Pin, Signal

rled = Signal(18, Pin.OUT, invert = True)
gled = Signal(19, Pin.OUT, invert = True)
bled = Signal(20, Pin.OUT, invert = True)

rled.off()
gled.off()
bled.off()

rled.off()

Off and on are working the right way round!

1 Like