Tiny 2040 RGB LED control - Tutorial

I just went on Pimoroni and ordered a true 8MB tiny2040 … Now to wait for it to get here from Great Britian which is why i bought the one i did Initially. I still going to mess with it and see if I can get it working.

Re the Waveshare…
As far as I can tell the Waveshare RP2040’s don’t use a regular three-pin RGB LED but use a digital WS2812 RGB LED on GPIO16. So, simple on-off codes won’t work the LED at all, you need the WS2812 library to control it.

Ah, OK, its a Waveshare RP2040 Tiny, not a Pimoroni Tiny 2040.
Yeah, the LED code for one doesn’t work on the other.

I at least got it working now knowing this. Thank You all for the insight…what can I say I’m learning! Here is the code i have that cycles through all the colors on the Waveshare rp2040 zero:

#WaveShare rp2040 zero utilizing Neopixil LED with all color options
#Using MicroPython (RP2040) Interpreter and uf2 MicroPython v1.20.0 on 2023-04-26; Raspberry Pi
Pico with RP2040
import machine, neopixel
from time import sleep
pixel_pin = 16
pixel = neopixel.NeoPixel(machine.Pin(pixel_pin), 1)
while 1:
pixel[0] = (0, 255, 0) #Green
pixel.write()
sleep(1.0)
pixel[0] = (255, 0, 0) #Red
pixel.write()
sleep(1.0)
pixel[0] = (0, 0, 255) #Blue
pixel.write()
sleep(1.0)
pixel[0] = (255, 0, 255) #A Color?
pixel.write()
sleep(1.0)
pixel[0] = (0, 255, 255) #Another Color??
pixel.write()
sleep(1.0)
pixel[0] = (255, 255, 0) #Yellow
pixel.write()
sleep(1.0)
pixel[0] = (255, 255, 255) #white
pixel.write()
sleep(1.0)

1 Like

I’ve been at this for what seems like forever, lol. I’m still learning stuff almost every day. =)

That board is tiny but is called a Waveshare RP2040-ONE.

I’m glad you have got it sorted.

We are all happy to help but when asking for assistance it is very important to to give precise and accurate information about the devices in question: Maker and the correct name are essential.

It is a great little board and plugs straight to the USB port in your laptop. They have managed to give access to so many GPIO lines in such a small form factor. Really useful and cheap enough to embed in a project.

Have fun now that it is working.