View cptr_funtimes.c
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
// some fun with C pointers | |
// 20 Mar 2023 | |
// compile with: gcc -o cptr_funtimes cptr_funtimes.c | |
#include <stdlib.h> | |
#include <stdio.h> | |
#define NUM_COLORS 5 | |
uint32_t global_colors[NUM_COLORS] = | |
{ |
View touchpio.py
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
# touchpio.py -- Capacitive Touch Sensing using Pico / RP2040 PIO using similar API to CircuitPython's "touchio" | |
# 24 Feb 2023 - @todbot / Tod Kurt | |
# # Uses ideas from "# PIO Capsense experiment / -scottiebabe 2022" from | |
# https://community.element14.com/products/raspberry-pi/f/forum/51242/want-to-create-a-capacitance-proximity-touch-sensor-with-a-rp2040-pico-board-using-pio/198662 | |
# | |
import time, array | |
import board | |
import rp2pio | |
import adafruit_pioasm | |
from supervisor import ticks_ms |
View simple_sse_server.js
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
// 20 Feb 2023 - @todbot / Tod Kurt, for carlynorama | |
// | |
// orig from: https://web.dev/eventsource-basics/ | |
var http = require('http'); | |
var fs = require('fs'); | |
var http_port = 8000 | |
console.log("starting server on port"+http_port) |
View audio_plus_http_post.py
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
# audio_plus_http_post.py -- Play audio while also POSTing to a URL on PicoW | |
# (or any CircuitPython device with native WiFi) | |
# 16 Feb 2023 - @todbot / Tod Kurt, from @studioStephe(she/they) post on Adafruit Discord | |
# | |
# Notes: | |
# - Glitches on first POST, but subsequent POSTs are glitch free. | |
# - Could get around this by muting mixer.voice[0].volume on first POST | |
# - Or could get around by doing throw-away POST before starting audio | |
# - The glitching appears to be related to DNS lookups? | |
# |
View masto-media-up.swift
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
// Hacky media upload to mastodon, does not post | |
// A condensation of things I learned about Swift and Mastodon API w/ @carlynorama | |
// 12 Feb 2023 - @todbot / Tod Kurt | |
// | |
// Compile with: | |
// swiftc masto-media-up.swift -o masto-media-up | |
// | |
// Requires: | |
// - existing Mastodon account on a given server ("--url") | |
// - authorization token from a created app in Mastodon ("--auth") |
View noise_square_code.py
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
# noise_square_code.py -- playing with simplex noise in CircuitPython | |
# 9 Feb 2023 - @todbot / Tod Kurt | |
# https://github.com/todbot/CircuitPython_Noise | |
# Uses Lolin ESP32-S2 Mini and 8x8 LED shield | |
# https://circuitpython.org/board/lolin_s2_mini/ | |
# | |
import time | |
import board | |
import neopixel | |
import rainbowio |
View vectorio_balls.py
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
# vectorio_balls.py -- show using vectorio.Circle | |
# 19 Jan 2023 - @todbot / Tod Kurt | |
import board, time, math, random | |
import displayio, vectorio, rainbowio | |
display = board.DISPLAY | |
disp_width,disp_height = display.width, display.height | |
screen = displayio.Group() # group that holds everything | |
display.show(screen) # add main group to display |
View pwm_encoder_fade.py
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 one way to do smooth LED/PWM fading if input is rotary encoder | |
# by having a separate "fader" that runs independent of encoder setting | |
# (but that smoothly catches up to it) | |
# 14 Jan 2023 - @todbot / Tod Kurt | |
# | |
import time | |
import board | |
import rotaryio |
View ds4_fakey_boot.py
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
# ds4_fakey_boot.py -- pretend to be a Playstation DS4 controller, using MacroPad RP2040 | |
# doesn't quite seem to work yet | |
# 8 Jan 2023 - @todbot / Tod Kurt | |
import usb_hid | |
import usb_midi | |
import supervisor | |
ds4_vid = 0x054C | |
ds4_pid = 0x05C4 |
View blinkm_simple_demo.py
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
# blinkm_simple_demo.py -- very simply demonstrate low-level BlinkM control | |
# 4 Jan 2023 - @todbot / Tod Kurt | |
# | |
# Note: BlinkMs are designed to be 5V devices, they may not work on 3.3V systems. | |
# You should really use a I2C level shifter like: https://www.adafruit.com/product/5637 | |
# If you're powering many BlinkMs or a BlinkM MaxM, you *definitely* need a level shifter, | |
# since you cannot risk sending 5V back to the 3.3V inputs of a CircuitPython board. | |
# | |
# Details of BlinkM protocol at http://thingm.com/s/BlinkM_datasheet.pdf | |
# |
NewerOlder