onboard_neopixel
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| onboard_neopixel [2026/07/19 13:24] – [NeoPixel Blink Code] walkeradmin | onboard_neopixel [2026/07/21 08:51] (current) – walkeradmin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== OnBoard NeoPixel ====== | ====== OnBoard NeoPixel ====== | ||
| - | <color #db5f0b>Jun 2026</ | + | <color #db5f0b>Jul 2026</ |
| \\ | \\ | ||
| \\ | \\ | ||
| Line 6: | Line 6: | ||
| ---- | ---- | ||
| ===== Introduction ===== | ===== Introduction ===== | ||
| + | \\ | ||
| + | * Not for Raspberry Pi Pico. | ||
| \\ | \\ | ||
| The RP2040-Zero mini has an onboard NeoPixel. So we cannot use the Raspberry Pi Pico code to use this LED. Instead we need to use some Micro Python specific to the Waveshare (or compatible) device. | The RP2040-Zero mini has an onboard NeoPixel. So we cannot use the Raspberry Pi Pico code to use this LED. Instead we need to use some Micro Python specific to the Waveshare (or compatible) device. | ||
| Line 61: | Line 63: | ||
| \\ | \\ | ||
| ---- | ---- | ||
| + | ==== NeoPixel Values ==== | ||
| + | The NeoPixel works on RGB values (0,0,0) so Red, Green, Blue. If you put a value in Red, you get red. The value can be from 0-255, 0 being off, 255 being max brightness. The options for the colours are listed below. | ||
| + | \\ | ||
| + | #other colours | ||
| + | #(255, 0, 0), # Red | ||
| + | #(0, 255, 0), # Green | ||
| + | #(0, 0, 255), # Blue | ||
| + | #(255, 255, 0), # Yellow | ||
| + | #(255, 0, 255), # Magenta | ||
| + | #(0, 255, 255), # Cyan | ||
| + | #(255, 255, 255),# White | ||
| + | #(0, 0, 0) # Off | ||
| - | ==== NeoPixel Blink Code with Comments ==== | + | So 255, 0, 0 will give a bright Red. 8, 0, 0 will give a dull Red. You don't have to use values of 255 all the time, you can use lower values to lower the LED brightness. |
| + | \\ | ||
| + | \\ | ||
| + | ---- | ||
| + | |||
| + | ==== NeoPixel Blink Code with Comments ==== | ||
| + | Below we can see the same code, but with lots and lots of comments to really help you understand how this Micro Python code works with the onboard Neo Pixel. | ||
| + | \\ | ||
| < | < | ||
| # Import the Pin class from the machine module. | # Import the Pin class from the machine module. | ||
| Line 88: | Line 109: | ||
| # | # | ||
| # Pin(LED_PIN) tells MicroPython which GPIO pin is connected | # Pin(LED_PIN) tells MicroPython which GPIO pin is connected | ||
| - | # to the LED. | + | # to the LED. The GPIO pin number is set by previous variable LED_PIN=16 |
| # | # | ||
| # The second parameter (1) tells it there is only ONE RGB LED | # The second parameter (1) tells it there is only ONE RGB LED | ||
| Line 113: | Line 134: | ||
| # Green = 0 | # Green = 0 | ||
| # Blue = 0 | # Blue = 0 | ||
| - | np[0] = (8, 0, 8) | + | np[0] = (8, 0, 8) # I changed the colour from bright Red to a soft Purple. |
| # Send the colour data to the LED. | # Send the colour data to the LED. | ||
onboard_neopixel.1784467459.txt.gz · Last modified: by walkeradmin
