Ive just got a Pico Explorer and so far I think its great. Im wondering if that analogue dial display shown on the packet and website is a mockup or a real image ? If real, does anyone know where I can find some sample code ?
can you post a link to the display picture you mean ,i dont have my packet anymore and the one i do see is just Tempture numbers
Hi. It is the dial in this picture. https://www.raspberrypi.com/app/uploads/2021/01/P1043110-Edit-Edit-768x543.jpg
Build your own - this may help:
Can you access FrameBuffer in Pimoroni PicoGraphics Micropython W - Support - Pimoroni Buccaneers
I’ve just put this up. Look at the end for the code.
Here is the code:
# Analogue Dial on a Pimoroni Pico Explorer with Pico Graphics
from picographics import PicoGraphics, DISPLAY_LCD_240X240
import math
import time
import random
import machine # for ADC pot
display = PicoGraphics(display=DISPLAY_LCD_240X240)
red = display.create_pen(255,0,0)
white = display.create_pen(255,255,255)
green = display.create_pen(0,255,0)
blue = display.create_pen(0,0,255)
black = display.create_pen(0,0,0)
yellow = display.create_pen(255,255,0)
# =========== Main Program ================
display.set_pen(black)
display.clear()
xc = 120
yc = 120
display.set_pen(blue)
display.circle(xc,yc,100)
r = 103 # Tick outer radius
for p in range(0,101,10): # White Ticks at 10 % intervals
theta = p * 2.7 -45
theta_rad = math.radians(theta) # Angle in radians
yn = -int(r * math.sin(theta_rad)) # Calculate outer tick coordinates
xn = -int(r * math.cos(theta_rad))
display.set_pen(white)
display.line(120,120,120+xn,120+yn) # Draw the tick from centre
display.set_pen(black)
display.circle(xc,yc,75) # Overwrite inner tick lines
d=r
display.triangle(xc,yc,xc+d-1,yc+d,xc-d,yc+d)
display.update()
# Counting up in fives
r = 74 # Length of hand
old_xn = 0
old_yn = 0
for p in range(0,101,5): # Percentages at 5 % interval
theta = p * 2.7 -45
display.set_pen(black)
display.line(120,120,120+old_xn,120+old_yn) # Overwrite the old hand
display.rectangle(0,200,240,25) # Clear text area
display.set_pen(green)
theta_rad = math.radians(theta)
theta_rad = math.radians(theta)
display.set_pen(white)
display.text(str(p) +" %",100,200,scale=3) # Percentage value as text
yn = -int(r * math.sin(theta_rad))
xn = -int(r * math.cos(theta_rad))
display.set_pen(red)
display.line(120,120,120+xn,120+yn) # Draw the new hand
display.update() # Update screen
time.sleep(0.3) # Delay
old_xn = xn # Store current hand end corordinates
old_yn = yn # for overwriting in next loop pass
display.update()
Just need to add a few numbers. - Have fun. (PS If the photo is real, I’d love to see the code.)