Skip to content

Instantly share code, notes, and snippets.

Avatar

Sandy Macdonald sandyjmacdonald

  • York, UK
View GitHub Profile
@sandyjmacdonald
sandyjmacdonald / github-graph-api.py
Last active Dec 20, 2022
Display a GitHub user commit graph on the Pimoroni Galactic Unicorn LED matrix
View github-graph-api.py
# Pop this on another machine, and run with:
# python3 github-graph-api.py --host 0.0.0.0
#
# Take note of this machine's IP address, as you'll
# need to add it in the GU code.
import requests
from bs4 import BeautifulSoup, SoupStrainer
from flask import Flask, jsonify, make_response
@sandyjmacdonald
sandyjmacdonald / WIFI_CONFIG.py
Last active Jul 3, 2022
An example of simple API to set the colour of the Pimoroni Inventor 2040's LEDs
View WIFI_CONFIG.py
SSID = ""
PSK = ""
@sandyjmacdonald
sandyjmacdonald / code.py
Last active Dec 18, 2022
CircuitPython USB MIDI to serial MIDI converter for Raspberry Pi Pico (RP2040)
View code.py
# CircuitPython USB MIDI to serial MIDI converter for Raspberry Pi Pico (RP2040).
# IMPORTANT! Should *only be used for MIDI in*, i.e. from USB devices to hardware
# MIDI synths, and *not* in the opposite direction. Doing so could risk damage to
# the microcontroller, your computer, or both.
# Wire a 10Ω resistor from the Tx pin on the Raspberry Pi Pico or other
# RP2040 board to the 3.5mm stereo jack tip, a 33Ω resistor from the 3v3 pin on
# the Raspberry Pi Pico to the 3.5mm stereo jack ring, and the ground pin on the
# Raspberry Pi Pico to the 3.5mm stereo jack sleeve.
@sandyjmacdonald
sandyjmacdonald / code.py
Created May 1, 2021
MIDI input example for the Pimoroni Tiny 2040 board
View code.py
# This example lights the RGB LED on Tiny 2040 to a different colour
# for each note in the octave. Listens on all MIDI channels by default.
import board
import adafruit_rgbled
import usb_midi
import adafruit_midi
from adafruit_midi.note_on import NoteOn
@sandyjmacdonald
sandyjmacdonald / code.py
Last active Jan 18, 2023
MIDI CC knob controller example for Raspberry Pi Pico
View code.py
import time
import board
import usb_midi
import adafruit_midi
from analogio import AnalogIn
from adafruit_midi.control_change import ControlChange
# MIDI CC knob controller example for Raspberry Pi Pico
@sandyjmacdonald
sandyjmacdonald / code.py
Created Jan 23, 2021
Emergency cat GIF macro example for Pimoroni RGB Keypad for Raspberry Pi Pico
View code.py
import time
import board
import busio
import usb_hid
from adafruit_bus_device.i2c_device import I2CDevice
import adafruit_dotstar
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
@sandyjmacdonald
sandyjmacdonald / code.py
Created Jan 21, 2021
RGB MIDI controller example for Pimoroni RGB Keypad for Raspberry Pi Pico
View code.py
import time
import board
import busio
import usb_midi
import adafruit_midi
from adafruit_midi.note_off import NoteOff
from adafruit_midi.note_on import NoteOn
from adafruit_bus_device.i2c_device import I2CDevice
import adafruit_dotstar
@sandyjmacdonald
sandyjmacdonald / usb-midi-cc-controller.ino
Created Oct 2, 2020
USB MIDI CC controller with Adafruit Trinket M0 and Pimoroni Potentiometer Breakout.
View usb-midi-cc-controller.ino
// USB MIDI CC controller with Trinket M0 and Pimoroni Potentiometer Breakout.
// Adapted from Chris Parrot's Potentiometer example.
#include <IOExpander.h>
#include <Adafruit_DotStar.h>
#include <MIDIUSB.h>
// Global constants
static const unsigned int DELAY_MS = 1000 / 30;
@sandyjmacdonald
sandyjmacdonald / install.sh
Created Feb 5, 2020
Temporary Pimoroni Pirate Audio installer fix
View install.sh
#!/bin/bash
DATESTAMP=`date "+%Y-%m-%d-%H-%M-%S"`
MOPIDY_CONFIG="/etc/mopidy/mopidy.conf"
MOPIDY_SUDOERS="/etc/sudoers.d/010_mopidy-nopasswd"
EXISTING_CONFIG=false
PYTHON_MAJOR_VERSION=3
PIP_BIN=pip3
function add_to_config_text {
@sandyjmacdonald
sandyjmacdonald / pirate-audio-google-music-support.md
Last active Sep 19, 2021
Pirate Audio Google Music Support
View pirate-audio-google-music-support.md
  1. Clone the Pirate Audio GitHub repo and install:
git clone https://github.com/pimoroni/pirate-audio
cd pirate-audio/mopidy
sudo ./install.sh

Detailed Pirate Audio installation instructions can be found here.