Esbeeb
February 3, 2026, 2:07pm
11
ggeoffre:
Same thing, same approach for direct comparison of different platforms, only in MicroPython this time…
import time, machine
ACTIVE_LOW_RGB = True
TINY2350_LED_R = machine.PWM(machine.Pin(18))
TINY2350_LED_R.freq(1000)
TINY2350_LED_B = machine.PWM(machine.Pin(19))
TINY2350_LED_B.freq(1000)
TINY2350_LED_G = machine.PWM(machine.Pin(20))
TINY2350_LED_G.freq(1000)
def pwm_set_rgb(red, blue, green):
if(ACTIVE_LOW_RGB):
red = 255-red; green = 255-green; blue = 255-blue
TINY2350_LED_R.duty_u16(int((red * 65535) / 255))
TINY2350_LED_B.duty_u16(int((blue * 65535) / 255))
TINY2350_LED_G.duty_u16(int((green * 65535) / 255))
while True:
pwm_set_rgb(255, 0, 0)
time.sleep(0.5)
pwm_set_rgb(0, 255, 0)
time.sleep(0.5)
pwm_set_rgb(0, 0, 255)
time.sleep(0.5)
Thanks! Noob here: I can confirm this code runs on a Tiny2350 (flashed earlier with MicroPython), this code being saved onto it, and run from Thonny. The LED blinks in alternating 3 colors: red, blue, and green
Note: I installed Thonny from python’s uv.