a couple of months ago i had to learn all this things through trial and error, it's great to see a video explaining the functions, i will make sure to see this video again any time i need to use the screen again
I wonder if you know which GPIO pins the Display Pack uses as I have had issues with unexpected crashes of the Pico when trying to use with the HC-SR04 Sonar Distance Measure example you had on your website. The pico would sometimes run for a few readings then freeze and would need power to be cycled before it would respond. Running on another Pico on a matrix board it worked perfectly. I am guessing that there is an interaction between the Display Pack GPIO and the interface to the HC-SR04. Cheers Peter
Nice job getting me started with graphics on the Pico! Well explained. It'll be at least a week before I actually get to programming, but now I know the steps involved, so thanks a big bunch o' somethin'. (Whatever ya like!) 'scribed! 👍👍 I'll be watching for more!
Good morning jeffro, Glad I could help and thanks for the kind words, much appreciated. Have fun with your project and keep us updated on the progress. Cheers! Chris
Thanks Chris for a great in depth tutorial. I’m trying to output to the pico onboard led and then eventually to other gpio at the same time the button is pressed but I’m not having only luck. Do you have a tutorial on this sort of thing Nick
Thank you, Chris, for producing such high quality content. I think I've watched all of your pico series videos. I noticed that you held up your production time sychronization device. It appeared to have a nice robust casing. I'm planning to build a few devices for some in-class actvities for my students. This display seems great for that. Can you kindly tell me what case you use and whether or not you think it will stand up to alot of use, passing around, dropping, etc. -best regards, Darin
Hello Darin, Thank you for the kind words and for joining the community, very much appreciated! The case is pretty tough and it just something I designed and 3D printed. It does seem to be holding up pretty good. Unfortunately, I didn't design it with internal power but it does do the job. Let me know if you want the Step/Stl files and if I have them I can post them on the website. Cheers! Chris
Just a quick issue on you code. For the animation you use: display.text("STOP!!", 150,60, angle = 20) but you show that it is flat. If I use that code with any of the vector fonts it does not show all of the word. If I just change it to: display.text("STOP!!", 150,60) It will work as you show.
Hi Chris ,here is my modified code from machine import Pin, Timer import time import utime from pimoroni import Button from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY_2, PEN_P4 from pimoroni import RGBLED led1_Pin =Pin(25,Pin.OUT) #output to onboard led hopefully # We're only using a few colours so we can use a 4 bit/16 colour palette and save RAM! display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2, pen_type=PEN_P4, rotate=0) display.set_backlight(0.5) display.set_font("bitmap8") led = RGBLED(6,7,8) led1_Pin = Pin(25,Pin.OUT) #onboard led timer = Timer() def blink(timer): led1.toggle() button_a = Button(12) button_b = Button(13) button_x = Button(14) button_y = Button(15) WHITE = display.create_pen(255, 255, 255) BLACK = display.create_pen(0, 0, 0) CYAN = display.create_pen(0, 255, 255) MAGENTA = display.create_pen(255, 0, 255) YELLOW = display.create_pen(255, 255, 0) GREEN = display.create_pen(0, 255, 0) # sets up a handy function we can call to clear the screen def clear(): display.set_pen(BLACK) display.clear() display.update() # set up clear() while True: if button_a.read(): # if a button press is detected then... clear() # clear to black display.set_pen(WHITE) # change the pen colour display.text("Button A pressed", 10, 10, 240, 4) # display some text on the screen display.update() # update the display led.set_rgb(255,255,255) led1_Pin.value(1) # onboard led led1_Pin.toggle() # onboard led time.sleep(1) # pause for a sec clear() # clear to black again
elif button_b.read(): clear() display.set_pen(CYAN) display.text("Button B pressed", 10, 10, 240, 4) display.update() led.set_rgb(0,255,255) time.sleep(1) clear() elif button_x.read(): clear() display.set_pen(MAGENTA) display.text("Button X pressed", 10, 10, 240, 4) display.update() led.set_rgb(255,0,255) time.sleep(1) clear() elif button_y.read(): clear() display.set_pen(YELLOW) display.text("Button Y pressed", 10, 10, 240, 4) display.update() led.set_rgb(255,255,0) time.sleep(1) clear() else: display.set_pen(GREEN) display.text("Press any button!", 10, 10, 240, 4) display.update() led.set_rgb(0,255,0) time.sleep(0.1) # this number is how frequently the Pico checks for button presses Cheers Nick
Hi nick, Unfortunately I am not sure what you are needing. Can you add comments in the program of what you are wanting to do, what you tried, and the result you got? Thanks, Chris
@@MakingStuffwithChrisDeHut Hi Chris, thank you for getting back to me. My aim is that when button A is pressed, it will automatically send a Pulse to The on board led on the raspberry pi pico, and I’m using a pico W. I therefore realise that the code is slightly different for a pico W as opposed to a standard pico, but I cannot call the on-board led simply LED. I have to call it, LED1 or something similar to differentiate between the RGB led and the on-board led. I hope this helps. If not, I will enumerate in the code.
@@nick-qw2zh HI again, I think I understand - (unfortunately TH-cam comments get messed up at times making it a problem to piece things together). I think you code looked okay but you are using PIN 25. Here is an example to toggle the on board LED for 1 second. from machine import Pin led = Pin("LED", Pin.OUT) led.on() sleep(1) led.off() Cheers! Chris
Great explanation and video. Thanks Chris!
Glad you liked it!
Cheers
Chris
a couple of months ago i had to learn all this things through trial and error, it's great to see a video explaining the functions, i will make sure to see this video again any time i need to use the screen again
Isn't "fun" have to go through the trial and error process like that. Thanks for sharing your input, much appreciated!
Cheers!
Chris
Just bought a Pimoroni Display Pack 2 so your tutorial was very useful to cover the library functions. Great little display.
Glad you found it helpful! I agree, they are great.
Cheers!
Chris
I wonder if you know which GPIO pins the Display Pack uses as I have had issues with unexpected crashes of the Pico when trying to use with the HC-SR04 Sonar Distance Measure example you had on your website. The pico would sometimes run for a few readings then freeze and would need power to be cycled before it would respond. Running on another Pico on a matrix board it worked perfectly. I am guessing that there is an interaction between the Display Pack GPIO and the interface to the HC-SR04. Cheers Peter
Nice job getting me started with graphics on the Pico!
Well explained.
It'll be at least a week before I actually get to programming, but now I know the steps involved, so thanks a big bunch o' somethin'. (Whatever ya like!)
'scribed! 👍👍
I'll be watching for more!
Good morning jeffro,
Glad I could help and thanks for the kind words, much appreciated. Have fun with your project and keep us updated on the progress.
Cheers!
Chris
Vielen Dank für diese Ausführliche Anleitung. Hat mir doch sehr geholfen :)
You are very welcome!
Cheers!
Chris
great job Chris!
Thank you Kevin, much appreciated!!!
Cheers!
Chris
Thanks Chris for a great in depth tutorial. I’m trying to output to the pico onboard led and then eventually to other gpio at the same time the button is pressed but I’m not having only luck. Do you have a tutorial on this sort of thing
Nick
Thank you, Chris, for producing such high quality content. I think I've watched all of your pico series videos. I noticed that you held up your production time sychronization device. It appeared to have a nice robust casing. I'm planning to build a few devices for some in-class actvities for my students. This display seems great for that. Can you kindly tell me what case you use and whether or not you think it will stand up to alot of use, passing around, dropping, etc. -best regards, Darin
Hello Darin,
Thank you for the kind words and for joining the community, very much appreciated! The case is pretty tough and it just something I designed and 3D printed. It does seem to be holding up pretty good. Unfortunately, I didn't design it with internal power but it does do the job. Let me know if you want the Step/Stl files and if I have them I can post them on the website.
Cheers!
Chris
@@MakingStuffwithChrisDeHut Hi Chris, if it's convenient for you, I'd love the STL files.
Hi Darin, it should be on this page - near the bottom....
makingstuffwithchrisdehut.com/electronics-files
Cheers!
Chris
@@MakingStuffwithChrisDeHut Got it. Thanks!
Just a quick issue on you code. For the animation you use:
display.text("STOP!!", 150,60, angle = 20)
but you show that it is flat.
If I use that code with any of the vector fonts it does not show all of the word. If I just change it to:
display.text("STOP!!", 150,60)
It will work as you show.
Wow, thanks for the additional information!
Cheers!
Chris
Thank You
You are very welcome good sir!
Cheers!
Chris
Hi Chris ,here is my modified code
from machine import Pin, Timer
import time
import utime
from pimoroni import Button
from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY_2, PEN_P4
from pimoroni import RGBLED
led1_Pin =Pin(25,Pin.OUT) #output to onboard led hopefully
# We're only using a few colours so we can use a 4 bit/16 colour palette and save RAM!
display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2, pen_type=PEN_P4, rotate=0)
display.set_backlight(0.5)
display.set_font("bitmap8")
led = RGBLED(6,7,8)
led1_Pin = Pin(25,Pin.OUT) #onboard led
timer = Timer()
def blink(timer):
led1.toggle()
button_a = Button(12)
button_b = Button(13)
button_x = Button(14)
button_y = Button(15)
WHITE = display.create_pen(255, 255, 255)
BLACK = display.create_pen(0, 0, 0)
CYAN = display.create_pen(0, 255, 255)
MAGENTA = display.create_pen(255, 0, 255)
YELLOW = display.create_pen(255, 255, 0)
GREEN = display.create_pen(0, 255, 0)
# sets up a handy function we can call to clear the screen
def clear():
display.set_pen(BLACK)
display.clear()
display.update()
# set up
clear()
while True:
if button_a.read(): # if a button press is detected then...
clear() # clear to black
display.set_pen(WHITE) # change the pen colour
display.text("Button A pressed", 10, 10, 240, 4) # display some text on the screen
display.update() # update the display
led.set_rgb(255,255,255)
led1_Pin.value(1) # onboard led
led1_Pin.toggle() # onboard led
time.sleep(1) # pause for a sec
clear() # clear to black again
elif button_b.read():
clear()
display.set_pen(CYAN)
display.text("Button B pressed", 10, 10, 240, 4)
display.update()
led.set_rgb(0,255,255)
time.sleep(1)
clear()
elif button_x.read():
clear()
display.set_pen(MAGENTA)
display.text("Button X pressed", 10, 10, 240, 4)
display.update()
led.set_rgb(255,0,255)
time.sleep(1)
clear()
elif button_y.read():
clear()
display.set_pen(YELLOW)
display.text("Button Y pressed", 10, 10, 240, 4)
display.update()
led.set_rgb(255,255,0)
time.sleep(1)
clear()
else:
display.set_pen(GREEN)
display.text("Press any button!", 10, 10, 240, 4)
display.update()
led.set_rgb(0,255,0)
time.sleep(0.1) # this number is how frequently the Pico checks for button presses
Cheers Nick
Hi nick,
Unfortunately I am not sure what you are needing. Can you add comments in the program of what you are wanting to do, what you tried, and the result you got?
Thanks,
Chris
@@MakingStuffwithChrisDeHut
Hi Chris, thank you for getting back to me.
My aim is that when button A is pressed, it will automatically send a Pulse to The on board led on the raspberry pi pico, and I’m using a pico W. I therefore realise that the code is slightly different for a pico W as opposed to a standard pico, but I cannot call the on-board led simply LED. I have to call it, LED1 or something similar to differentiate between the RGB led and the on-board led. I hope this helps. If not, I will enumerate in the code.
@@nick-qw2zh HI again, I think I understand - (unfortunately TH-cam comments get messed up at times making it a problem to piece things together). I think you code looked okay but you are using PIN 25. Here is an example to toggle the on board LED for 1 second.
from machine import Pin
led = Pin("LED", Pin.OUT)
led.on()
sleep(1)
led.off()
Cheers!
Chris
@@MakingStuffwithChrisDeHut thanks Chris I’ll give it a go