Skip to content

Instantly share code, notes, and snippets.

View todbot's full-sized avatar
doing the blink1

Tod Kurt todbot

doing the blink1
View GitHub Profile
gamblor21 /
Created May 31, 2023 23:53
Drums for Circuitpython synthio
import ulab.numpy as np
import random
import synthio
sinwave1 = np.array(np.sin(np.linspace(0, 2*np.pi, SAMPLE_SIZE, endpoint=False)) * 32767, dtype=np.int16)
sinwave2 = np.array(np.sin(np.linspace(np.pi/2, 2.5*np.pi, SAMPLE_SIZE, endpoint=False)) * 32767, dtype=np.int16)
downwave = np.linspace(32767, -32767, num=3, dtype=np.int16)
noisewave = np.array([random.randint(-32767, 32767) for i in range(SAMPLE_SIZE)], dtype=np.int16)
anecdata /
Last active February 11, 2024 22:56
CircuitPython example for Espressif ESP-NOW protocol
# SPDX-FileCopyrightText: 2023 anecdata
# SPDX-License-Identifier: MIT
import time
import traceback
import supervisor
import os
import rtc
import espnow
joshka /
Last active October 14, 2022 19:32
8/Any pin PIO based UART TX code for a Raspberry Pi Pico

Raspberry Pi Pico PIO 8 Pin UART TX

This code creates a UART TX on 8 sequential pins of the Raspberry Pi Pico. The main use case being MIDI splitter devices

The second 16 port implementation should work for any number of pins, but just acts as a pure copy to those pins instead of having individual control over every pin of every byte. Hence while less flexible, the controlling software is simpler (just send a uart byte and it's copied to every pin).

Only tested in the simulator so far.

Used to go from uart_tx.pio.h to uart_tx.h

anecdata /
Last active March 30, 2023 18:39
Rough Monitor Dumper
import gc
import time
import board
import digitalio
import supervisor
import random
import wifi
import espidf
import ipaddress
import time
import board
import rotaryio
import touchio
import digitalio
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
from adafruit_hid.consumer_control import ConsumerControl
dglaude /
Created February 28, 2021 00:00
Gt-Py Knob midi control
# -- Mount a rotary encoder directly to an Adafruit QT Py,
# use it for midi CC message
# 2020 @todbot / Tod Kurt
# 2021 @David.Glaude / David Glaude
import time
import board
from digitalio import DigitalInOut, Direction, Pull
import rotaryio
Neradoc /
Last active July 12, 2023 07:49 implementing waiting to start into safe mode on Raspberry pico
import board
import time
from digitalio import DigitalInOut,Pull
led = DigitalInOut(board.LED)
safe = DigitalInOut(board.GP14) # <----- choose your pin with a button on it
todbot /
Last active December 5, 2020 06:18
Given a list of preferred networks, connect to the one with the strongest signal, for CircuitPython ESP32S2
# -- Given a list of preferred networks,
# connect to the one with the strongest signal
# for CircuitPython ESP32S2 Metro / MagTag
# 2020 @todbot /
import time
import wifi
from secrets import secrets
citruz /
Last active June 6, 2024 08:29
Create Ubuntu and Windows VMs with QEMU on Apple Silicon

Running Linux and Windows on M1 with QEMU

30.11.2020: Updated with the new patchseries and instructions for Windows

02.12.2020: Added tweaks

08.12.2020: Updated with patchseries v4

31.01.2020: Updated with patchseries v6

todbot / FastLEDTinyFireSim.ino
Last active April 13, 2021 18:16
Tiny fire simulation for QT Py or any FastLED-supporting board
// modeled after
// must use latest FastLED checkout from
// as FastLED 3.3.3 doesn't have QT Py support
#include "FastLED.h"
#define LED_PIN 0
#define NUM_LEDS 8
void setup() {