Unicorn hat HD - how to write to the buffer


#1

To achieve scrolling displays on my unicorn hat, I manipulate the display buffers:

Buffer = unicorn.get_pixels()
…do stuff…
unicorn.set_pixels(Buffer)

Now I am porting my code to a unicornHD, but there does not seem to be a set_pixels() command.
Am I misreading things? Is there a better way to do this?


#2

I think the way to do it would be to write directly to the buffer with:

unicornhathd._buf[x][y] = r, g, b

You can see the way the set_pixel method does it internally here.


#3

Ok thanks. I’ll give that a try. I was just used to reading the buffer as a whole, then writing at a whole. Not sure why the HD is different. Maybe I am the only one doing crazy stuff with it.