Yellow not working on pico unicorn?

Hi,

I can’t seem to get some colours to display on my pico unicorn - in particular yellows don’t appear to show at all, and just come out green.

I’ve written a small program to drive each colour channel combination such that the output should be, from left to right:

  • Red 0 … 255
  • Green 0 … 255
  • Blue 0 … 255
  • Red + Green (Yellow) 0 … 255
  • Red + Blue (Purple) 0 … 255
  • Green + Blue (Cyan) 0 … 255
  • Red + Green + Blue (white) 0 … 255

In reality the output is Red, green, blue, green, purple-ish, white, white

If I drive a channel from 0…255 R and a fixed 255 G the output should be, in theory, totally green through to totally yellow - instead each cell is exactly the same.

Colours are a bit wrong but I think they get across there’s no change in the colour as the red channel increases - it’s the same colour output all the way.

Am I doing something wrong? Limitation in the colour output of the unicorn? From the photo Pico Unicorn Pack – Pimoroni it looks like yellow should be supported in that there’s a gradient between the red and green

Code snippet demonstrating how I’m calculating the 0…255 R and a fixed 255G - can post the full program if desired but it’s more of the same. (Each pixel is set to 0,0,0 before this line to make sure they’re being reset)

for x in range(0, w):
    c =  x * 255 // w
    uni.set_pixel(x, 0, c, 255, 0)

Does the demo example display OK?
pimoroni-pico/demo.py at main · pimoroni/pimoroni-pico · GitHub

My python skills are about average, I’ll need to see the whole code to have any hope of spotting anything. Might also help those that actually know a thing or two about python.
Code tags are three ` before and after you block of code. That will keep indents etc.

Just FYI as I’m a bit confused by some of what you posted?
Namely the * Red + Green (Yellow) 0 … 255
It goes (r, g, b) so yellow would be (255, 255, 0)

Hi,

Thanks for the heads up on the demo program - I’m not sure what the output should be?

Full code I used to produce the solid block of colour above:

import picounicorn as uni
import random
import time

uni.init()

w = uni.get_width()
h = uni.get_height()
  
# clear the screen   
for y in range(0, h):
    for x in range(0, w):
        uni.set_pixel(x, y, 0, 0, 0)
    
#draw a line from zero red to full red with constant full green 
for x in range(0, w):
    c =  x * 255 // w
    uni.set_pixel(x, 0, c, 255, 0)  

The demo likely displays a rainbow pattern. I don’t own a Pico Unicorn, just so you know. I do have a Unicorn Mini HD and Unicorn Hat HD.
Maybe it needs to be c = x * (255 // w) ? But then again my Python skills are wanting. ;)

Hi,

Sorry for being fashionably late, as usual.

I picked up a pico unicorn in the sale. Arrived today. Have been tinkering.

I’ve found that in order to get the correct colours to display. The green and blue values should max at 128 instead of 255. For example to set a pixel to “white” I would use:

picounicorn.set_pixel(0, 0, 255, 128, 128)

Using the code in post 4, when adjusting the values of any green or blue to a max of 128. The correct colours now are displayed.

Hope that posting here may help, or help others, though suspect they are enjoying their shiny new cosmic unicorns. 😉

(Edit: wrong post number - doh)