Skip to main content

The BlinkPico shield library to be used with RPI Pico

Project description

RPi-BlinkPico Library

Instructions and example code for using BlinkPico with MicroPython and RaspberryPI Pico.

Matrix Display

You can get access of the LED matrix display through the variable display.

  • blink_rate(rate=None)

Choose the blink rate of the LEDs from these options: Matrix.NO_BLINK, Matrix.BLINK_SLOW, Matrix.BLINK_MEDIUM, and Matrix.BLINK_FAST.

  • brightness(brightness)

Set the value of the brigthness of the LEDs from 0 to 100.

  • fill(value)

Set all the LEDs of the display on if the value is 1, or off if value is 0.

  • show()

Update the LEDs of the display.

  • clear()

Set all pixels off (same as fill(0))

  • auto_show(show=False)

Automatically update the LEDs of the display upon changes.

Note

This code is adapted from the AdaFruit Circuitpython library.

Examples

Here an example of how to use the LED display to draw a smily face

from pyblinkpico import *
import time

display.brightness(50)
display.blink_rate(Matrix.NO_BLINK)
display.auto_show(True)
display.clear()

# smile
for row in range(2, 6):
    display[row, 0] = 1
    display[row, 7] = 1
    time.sleep_ms(100)

for column in range(2, 6):
    display[0, column] = 1
    display[7, column] = 1
    time.sleep_ms(100)

display[1,1] = 1
display[1,6] = 1
display[6,1] = 1
display[6,6] = 1

# eyes
display[2,2] = 1
display[2,5] = 1

# mouth
display[4,2] = 1
display[4,5] = 1
display[5,3] = 1
display[5,4] = 1

Button

There are three buttons available: button_a, button_b and button_c.

  • is_pressed

Returns True if the specified button is currently being held down, and False otherwise.

  • was_pressed

Returns True or False to indicate if the button was pressed (went from up to down) since the device started or the last time this method was called. Calling this method will clear the press state so that the button must be pressed again before this method will return True again.

  • get_presses

Returns the running total of button presses, and resets this total to zero before returning.

Note

Buttons behave as described in this page.

Examples

Here an example of how to use the buttons

from pyblinkpico import *
import time

while True:
  print(button_a.is_pressed())
  print(button_b.is_pressed())
  print(button_c.is_pressed())
  time.sleep(2)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyblinkpico-0.2.1.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file pyblinkpico-0.2.1.tar.gz.

File metadata

  • Download URL: pyblinkpico-0.2.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.9

File hashes

Hashes for pyblinkpico-0.2.1.tar.gz
Algorithm Hash digest
SHA256 22faae60a55b6cbd071d24ac49cb621b1a43fd43a9da4e1f69029cbe71664929
MD5 bd46d7a5e8e82966f0e267f2c391d5d0
BLAKE2b-256 a4bb3ac699968538de48df2e4c68e69f4cae23199e57fc55a0e42c57641ff6bd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page