Skip to content

Instantly share code, notes, and snippets.

@wildestpixel
wildestpixel / seesaw rotary consumer.py
Created May 27, 2021 05:39
Quick code to create a volume and pause play encoder in CP 6.3
# SPDX-FileCopyrightText: 2021 John Furcean
# SPDX-License-Identifier: MIT
import board
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.digitalio import DigitalIO
from adafruit_seesaw.rotaryio import IncrementalEncoder
from adafruit_hid.consumer_control import ConsumerControl
from adafruit_hid.consumer_control_code import ConsumerControlCode
import usb_hid
@wildestpixel
wildestpixel / code.py
Last active March 12, 2021 08:03
BME 280 Matrix Breakout Pico
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
# Download the latest version of the IS31FL3731 library: https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731/archive/master.zip
# soon available from https://circuitpython.org/libraries in the "Bundle Version 6.x"
# Also take the adafruit_framebuf too from the library bundle
#
# Download the font font5x8.bin from https://github.com/adafruit/Adafruit_CircuitPython_framebuf/blob/master/examples/font5x8.bin
# also available from https://circuitpython.org/libraries in the "Bundle Examples" in the adafruit_framebuf library
#
@wildestpixel
wildestpixel / code.py
Last active March 5, 2021 19:58
Circuitpython Pimoroni rgbkeypad based on martinohanlon library - very easy to use
# From the example of martinohanlon at https://github.com/martinohanlon/pico-rgbkeypad/blob/main/examples/hid_keyboard.py
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
from rgbkeypad import *
kbd = Keyboard(usb_hid.devices)
layout = KeyboardLayoutUS(kbd)
@wildestpixel
wildestpixel / code.py
Created February 15, 2021 05:40
Pimoroni Pico Explorer & BME280 Breakout
import board
import busio
import time
import terminalio
import displayio
from adafruit_display_text import label
from adafruit_st7789 import ST7789
import adafruit_bme280
i2c = busio.I2C(board.GP21, board.GP20)
@wildestpixel
wildestpixel / code.py
Created February 12, 2021 18:00
Pico Explorer Circuitpython display with temperature sensor
import board
import busio
import time
import terminalio
import displayio
from adafruit_display_text import label
from adafruit_st7789 import ST7789
import adafruit_pct2075
i2c = busio.I2C(board.GP21, board.GP20)
@wildestpixel
wildestpixel / code.py
Created February 6, 2021 18:42
Pimoroni Pico Display Pack Circuitpython 6.2b1 bitmap gradient
"""
adapted from http://helloraspberrypi.blogspot.com/2021/01/raspberry-pi-picocircuitpython-st7789.html
"""
import os
import board
import time
import terminalio
import displayio
import busio
@wildestpixel
wildestpixel / code.py
Created February 6, 2021 18:30
Pimoroni Pico Display Pack Circuitpython 6.2 b1 running code
"""
adapted from http://helloraspberrypi.blogspot.com/2021/01/raspberry-pi-picocircuitpython-st7789.html
"""
import os
import board
import time
import terminalio
import displayio
import busio
@wildestpixel
wildestpixel / code.py
Last active July 17, 2022 23:43
Raspberry Pi Pico & Pimoroni RGB Keypad HID in Circuitpython 6.2+
# Adapted from Sandy J Macdonald's gist at https://gist.github.com/sandyjmacdonald/b465377dc11a8c83a8c40d1c9b990a90 to configure all buttons and switch off all lights in loop
import time
import board
import busio
import usb_hid
from adafruit_bus_device.i2c_device import I2CDevice
import adafruit_dotstar