Пример #1
0
def start_up(init=True):
    print('....initialising....')
    picounicorn.init()
Пример #2
0
import time
import picounicorn

picounicorn.init()


# From CPython Lib/colorsys.py
def hsv_to_rgb(h, s, v):
    if s == 0.0:
        return v, v, v
    i = int(h * 6.0)
    f = (h * 6.0) - i
    p = v * (1.0 - s)
    q = v * (1.0 - s * f)
    t = v * (1.0 - s * (1.0 - f))
    i = i % 6
    if i == 0:
        return v, t, p
    if i == 1:
        return q, v, p
    if i == 2:
        return p, v, t
    if i == 3:
        return p, q, v
    if i == 4:
        return t, p, v
    if i == 5:
        return v, p, q


width = picounicorn.get_width()
Пример #3
0
#  https://rosettacode.org/wiki/Plasma_effect#Python               #
#                                                                  #
#  Took my first steps into framebuffering with the help of:       #
#  https://github.com/harveysandiego/raspberry_pi_pico_micropython #
#                                                                  #
#  rainbow_colors(h) is a simplified version of                    #
#  CPythons colorsys module's hsv_to_rgb converter                 #
#  (for in a rainbow s and v are always 1)                         #
#                                                                  #
####################################################################

import picounicorn
import math
import framebuf

picounicorn.init()  # setting up the picounicorn
w = picounicorn.get_width()
h = picounicorn.get_height()

t = 0  # kind of time variable (don't need utime module, calculations make the pico slow enough)
ti = 0.15  # increment for the time
da = False  # debouncer for BUTTON_A
db = False  # debouncer for BUTTON_B
dx = False  # debouncer for BUTTON_X
dy = False  # debouncer for BUTTON_Y
cm = 0  # the color mode, can be 0 (polychrome) or 1 (monochrome)
tm = 1  # text mode
wm = 0  # which message
fbw = 0  # framebuffer width
fc = -10  # framebuffer counter for scrolling an renewing