Last active
July 14, 2021 15:50
-
-
Save dalekmad/aa882580d6fba0e520e636d67263ab80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Meditation bubble for Raspberry Pi Pico | |
#Created by @dalekmad, July 2021 | |
#importing the picodisplay | |
import picodisplay as display | |
import utime | |
# Get the width of the display, in pixels | |
width = display.get_width() | |
# Get the height of the display, in pixels | |
height = display.get_height() | |
# Initialise Picodisplay with a bytearray display buffer | |
buffer = bytearray(width * height * 2) | |
display.init(buffer) | |
#set the backlight of the disply, 1.0 is fully on | |
display.set_backlight(0.9) | |
# set the pen colour and pen | |
penO = display.create_pen(28, 81, 214) | |
penB = display.create_pen(0, 0, 0) | |
b_in = "Breathe In" | |
b_out = "Breathe Out" | |
while True: | |
for x in range(22,45,1): | |
display.set_pen(penB) | |
display.clear() | |
display.set_pen(penO) | |
display.text(b_in, 40, 110, 240, 3) | |
display.circle(120,50,x) | |
display.update() | |
utime.sleep_ms(180) | |
display.text(" ", 40, 110, 240, 3) | |
display.update() | |
for x in range(45,22,-1): | |
display.set_pen(penB) | |
display.clear() | |
display.set_pen(penO) | |
display.text(b_out, 35, 110, 240, 3) | |
display.circle(120,50,x) | |
display.update() | |
utime.sleep_ms(180) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment