This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple MIDI input using MIDI Library on Pico | |
// 2 Mar 2023 - @todbot / Tod Kurt | |
#include <MIDI.h> | |
// Serial MIDI, could be "Serial1" or "Serial2" depending on pins on Pico | |
// See: https://arduino-pico.readthedocs.io/en/latest/serial.html | |
// and https://pico.pinout.xyz/ | |
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDIserial); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wire a rotary encoder to GP2,GP3, and encoder switch to GP4, with commons going to Gnd | |
import board | |
import rotaryio | |
import keypad | |
import usb_hid | |
from adafruit_hid.keyboard import Keyboard | |
from adafruit_hid.keycode import Keycode | |
CLK_PIN = board.GP4 | |
DT_PIN = board.GP3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
beatfader_demo.py -- fade between different drum loops | |
10 Jun 2024 - @todbot / Tod Kurt | |
originally from | |
https://github.com/todbot/circuitpython-tricks/blob/main/larger-tricks/beatfader.py | |
Demonstrate how to play WAVs via PWM audio | |
Functions, designed for QTPy RP2040 or Xiao RP2040: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Modified 12 Jun 2024 - @todbot -- added USB MIDI forwarding | |
* originally from: https://github.com/rppicomidi/EZ_USB_MIDI_HOST/blob/main/examples/arduino/EZ_USB_MIDI_HOST_PIO_example/EZ_USB_MIDI_HOST_PIO_example.ino | |
* Be sure to set "Tools / CPU Speed" to 120 MHz or 240 MHz and | |
* be sure to set "Tools / USB Stack" to "Adafruit TinyUSB" | |
*/ | |
/* | |
* The MIT License (MIT) | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# qteye_picodvi.py - qteye.py but on a PicoDVI RP2040 board | |
# 19 May 2024 - @todbot, on a DJDevon3 suggestion in Discord | |
# 23 Oct 2022 - @todbot / Tod Kurt | |
# Part of https://github.com/todbot/CircuitPython_GC9A01_demos | |
# also see: https://twitter.com/todbot/status/1584309133263532033 | |
# and: https://twitter.com/todbot/status/1584309133263532033 | |
# Copy this file as "code.py" and the two eyeball BMP files to CIRCUITPY drive | |
# To install needed libraries: "circup install adafruit_imageload" | |
# | |
# Video demo below as a comment to this gist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// esp32s3_i2s_simple_sine.ino | |
// demonstrate I2S on ESP32S3 | |
// origally from guiguig on Discord: https://discord.com/channels/327254708534116352/422210663507558401/1240067408660795424 | |
// video demo below in comment | |
#include <I2S.h> | |
#define BCK 16 // feather esp32s3 A2 | |
#define DOUT 17 // feather esp32s3 A1 | |
#define LCK 18 // feather esp32s3 A0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# raise_vs_return_code.py -- Attempt to estimate cost of exception raise vs return in CircuitPython | |
# 14 May 2024 - @todbot | |
import time | |
import random | |
import gc | |
num_runs = 50000 | |
# functions that do a small amount of something but really nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# demonstrate odd usb.core.USBError with max3421e | |
# requires "adafruit_usb_host_midi_todbot" below, which adds timeout on read()s | |
# 12 May 2024 - @todbot | |
import displayio | |
displayio.release_displays() | |
import time | |
import board | |
import usb | |
import max3421e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Demonstrate trying to use the USBError of usb.core.Device.read() as a | |
# "no bytes available" indicator. Unfortuately, it's VERY slow. | |
# Or more likely, it's missing messages mid-parse. | |
# 8 May 2024 - @todbot | |
# | |
# note, this requires two special libraries: | |
# - adafruit_usb_host_midi_hostreadhack | |
# - winterbloom_smolmidi_hostreadhack | |
import time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# waiting_for_midi_code.py -- I'm always blocking for midi | |
# 6 May 2024 - @todbot | |
# works on PicoDVI RP2040 Feather / DVI Cowbell / etc. | |
import time, math, random | |
import board | |
import displayio | |
import bitmaptools | |
from adafruit_display_text import bitmap_label as label | |
num_colors = 16 # how many colors for our bitmap, can't be over 16 for DVI |
NewerOlder