๐พ Archived View for m0yng.uk โบ 2021 โบ 07 โบ Raspberry-Pi-Pico-Display-Pride captured on 2023-09-08 at 16:05:40. Gemini links have been rewritten to link to archived content
โฌ ๏ธ Previous capture (2023-07-22)
โก๏ธ Next capture (2024-05-10)
-=-=-=-=-=-=-
Created 2021-07-22
I couldn't resist the raspberry pi pico any longer, and I also got a pico display to do with it. This is a pico sized hat that sits directly onto the pico and provides a nice full colour screen, RGB LED, and 4 buttons.
After playing with the demo code I wanted to try something myself, so I thought I'd try making a name badge of sorts, and using the pride flag as the background. Then I wanted to use the buttons, so made each button show a different flag. The LED also changes, trying to show some key colours from the flag.
It can show:
In this quick demo I've made it run through the flags automatically.
GIF of Pico display showing the flags [IMG]
Code uses the Pimoroni Pico Firmware
import time import utime import picodisplay as display width = display.get_width() height = display.get_height() display_buffer = bytearray(width * height * 2) # 2-bytes per pixel (RGB565) display.init(display_buffer) display.set_backlight(1.0) display.set_led(255,255,0) display.set_pen(255,255,0) display.clear() def clear(): display.set_pen(0, 0, 0) display.clear() display.update() def draw_trans(): clear() stripe_height = int(height/5) display.set_pen(91,207,250) display.rectangle(0,0,width,stripe_height) display.rectangle(0,stripe_height*4,width,stripe_height) display.set_pen(245, 171, 185) display.rectangle(0,stripe_height,width,stripe_height) display.rectangle(0,stripe_height*3,width,stripe_height) display.set_pen(255, 255, 255) display.rectangle(0,stripe_height*2,width,stripe_height) display.set_led(255,0,255) display.set_pen(0,0,0) def draw_pride(): clear() stripe_height = int(height/6) display.set_pen(229,0,0) display.rectangle(0,stripe_height*0,width,stripe_height) display.set_pen(255, 141, 0) display.rectangle(0,stripe_height*1,width,stripe_height) display.set_pen(255, 238, 0) display.rectangle(0,stripe_height*2,width,stripe_height) display.set_pen(0, 129, 33) display.rectangle(0,stripe_height*3,width,stripe_height) display.set_pen(0,76,255) display.rectangle(0,stripe_height*4,width,stripe_height) display.set_pen(118, 1, 136) display.rectangle(0,stripe_height*5,width,stripe_height) display.set_led(100,100,100) display.set_pen(0,0,0) def draw_intersex(): clear() display.set_pen(255, 217, 0) display.clear() display.set_pen(122, 0, 172) display.circle(int(width/2), int(height/2), int(height/3)) display.set_pen(255, 217, 0) display.circle(int(width/2), int(height/2), int(height/4)) display.set_led(122, 0, 172) display.set_pen(0,0,0) def draw_bi(): clear() stripe_height = int(height/5) display.set_pen(214,2,112) display.rectangle(0,stripe_height*0, width, stripe_height*2) display.set_pen(155,79,150) display.rectangle(0,stripe_height*2, width, stripe_height) display.set_pen(0,56,168) display.rectangle(0,stripe_height*3, width, stripe_height*2) display.set_led(155,0,150) display.set_pen(0,0,0) def draw_details(): display.set_pen(0,0,0) display.text("Christopher", 5, 10, 100, 4) display.text("M0YNG", 20, 40, 100, 7) display.update() while True: if display.is_pressed(display.BUTTON_A): draw_trans() display.text("Trans Rights!", 20,40,100,7) display.update() utime.sleep(2) draw_trans() elif display.is_pressed(display.BUTTON_B): draw_pride() display.text("Stonewall was a riot", 10,10,100,4) display.update() utime.sleep(2) draw_pride() elif display.is_pressed(display.BUTTON_X): draw_intersex() display.text("", 5, 10, 100, 7) display.update() utime.sleep(2) draw_intersex() elif display.is_pressed(display.BUTTON_Y): draw_bi() display.text("", 5, 10, 100, 7) display.update() utime.sleep(2) draw_bi() draw_details() utime.sleep(0.1)
-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-
๐ค Black Lives Matter
๐๐ค๐ Trans Rights are Human Rights
โค๏ธ๐งก๐๐๐๐ Love is Love
Copyright ยฉ 2023 Christopher M0YNG - It is forbidden to use any part of this site for crypto/NFT/AI related projects.
Code snippets are licenced under the Hippocratic License 3.0 (or later.)
Page generated 2023-09-03 by Complex 19