Skip to content

Instantly share code, notes, and snippets.

# SPDX-FileCopyrightText: 2025 Musical Scales Library
# SPDX-License-Identifier: MIT
"""
Musical Scales Library for MIDI Step Sequencer
Contains scales from Western, Middle Eastern, Asian and global traditions
All scales are provided as MIDI note numbers across 3 octaves (C3-C6)
"""
# Musical scales - Western, Middle Eastern, Asian and global traditions
SCALES = {
@jedgarpark
jedgarpark / knobby_sequencer.py
Last active June 24, 2025 22:14
knobby_sequencer.py
# SPDX-FileCopyrightText: john park for Adafruit 2025 MIDI Step Sequencer
# SPDX-License-Identifier: MIT
"""
MIDI Step Sequencer for QT Py RP2040 with NeoRotary 4 encoders
Single track, 8-step sequencer:
- Each encoder controls one step's note pitch
- Encoder buttons toggle steps on/off
- External 24-pixel NeoPixel strip shows step status and current playback position
- Sends MIDI notes via USB
- OPTIMIZED: I2C reads only after step 8, no encoder board NeoPixels
/*
DMX controller to NeoPixel strips
John Park for Adafruit Industries 2024
*/
#include <Conceptinetics.h>
#include <Adafruit_NeoPixel.h>
// User adjust these for the number of strips, pins, pixels per strip, and color formats:
#define NUM_STRIPS 3
#include <Conceptinetics.h>
#include <Adafruit_NeoPixel.h>
#define NUMSTRIPS 2
#define STRIP1_PIN A0
#define STRIP2_PIN A2
#define STRIP1_NUMPIXELS 30
#define STRIP2_NUMPIXELS 20
Adafruit_NeoPixel strip1(STRIP1_NUMPIXELS, STRIP1_PIN, NEO_GRB + NEO_KHZ800); // set proper color order here, typical is 'GRB', the Adafruit 'heart', 'ball', 'sphere' strips are BGR
@jedgarpark
jedgarpark / gist:fa09a0e18a625bd332e5fa55139bbd45
Created November 21, 2024 19:00
DMX_receive_neopixel.ino
#include <Conceptinetics.h>
#include <Adafruit_NeoPixel.h>
#define PIN 12
#define NUMPIXELS 16
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
//
// The slave device will use a block of 10 channels counting from
// its start address.
//
# SPDX-FileCopyrightText: Copyright (c) 2024 John Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
USB C PD power supply w HUSB238
pick voltages and then set them, measures high side current with INA219
"""
import time
import board
import displayio
# SPDX-FileCopyrightText: Copyright (c) 2023 Scott Shawcroft for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2024 Tod Kurt
# SPDX-FileCopyrightText: Copyright (c) 2024 John Park
# SPDX-License-Identifier: Unlicense
#
# Forward MIDI from device on USB Host port to computer via USB MIDI
# and 5-pin serial MIDI via MIDI Feather Wing or similar MIDI output.
# Suppots hot-plug of the device on the USB Host port.
# SPDX-FileCopyrightText: 2024 John Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
Drum Track Sequencer
Feather RP2040, Motor FeatherWing, stepper motor,
four reflection sensors (either MIDI out or synthio w amp)
"""
# SPDX-FileCopyrightText: Copyright (c) 2023 Scott Shawcroft for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2024 Tod Kurt
# SPDX-FileCopyrightText: Copyright (c) 2024 John Park
# SPDX-License-Identifier: Unlicense
#
# Forward MIDI from device on USB Host port to computer via USB MIDI
# and 5-pin serial MIDI via MIDI Feather Wing or similar MIDI output.
# Suppots hot-plug of the device on the USB Host port.
# jpeg loader slideshow
# based on color summarizer by @todbot / Tod Kurt
#https://gist.github.com/todbot/0bf32a6bf8dd21983a32bafc173b3223#file-code_color_palette_finder-py
import time
import board
import displayio
import jpegio
from adafruit_hx8357 import HX8357
import gc