Useful functions for creating games and apps with Sprig
Project description
Sprig Essentials
Useful functions to simplify the process of creating games and apps with Sprig.
This package is not affiliated with Sprig or HackClub in any form.
Documentation
This package is intended to run on any type of Raspberry Pi
.
Most focused on the Raspberry Pi Pico H
.
Display
This package assumes you're using the ST7735
display and that you've installed CircuitPython
.
The wiring diagram that this package assumes is intended for anyone using a Sprig, however, you can also wire this manually and achieve the same effect.
Wiring Diagram
INSERT IMAGE HERE
Imports
You will need to import the following to connect to the pins.
import board
If you're using a Sprig, chances are the wiring is going to be the exact same through the board, so you can skip to quickStartDisplay()
.
startBacklight()
def startBacklight(backlight_pin):
# Create the digital output
backlight = digitalio.DigitalInOut(backlight_pin)
# Set it as output
backlight.direction = digitalio.Direction.OUTPUT
# Turn it on
backlight.value = True
return backlight
This function takes in the pin number where the LITE
pin on the display is connected to (formatted like so: board.GP0
), and turns the backlight on.
It returns an object of type digitalio.DigitalInOut
which will be used in other functions.
Example
import board
backlight = startBacklight(board.GP17)
createSPI()
def createSPI(clock_pin, MOSI_pin, MISO_pin):
spi = busio.SPI(clock=clock_pin, MOSI=MOSI_pin, MISO=MISO_pin)
return spi
This function takes in 3 pin numbers (formatted like so: board.GP0
) and creates an SPI which will be used when creating a display bus.
It returns an object of type busio.SPI
.
Example
import board
spi = createSPI(board.GP18, board.GP19, board.GP16)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sprig_essentials-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e84a237944ddf980ef9993fb86459ad890d571751436b28001eaacd6b4d0d67 |
|
MD5 | 31782c20eda7d2abf2de8eb22f48451b |
|
BLAKE2b-256 | 4763d741609b61bb18468a1318a7b55501feebf6d22fdf3fb84f87fa5cb48c66 |