Skip to content

Instantly share code, notes, and snippets.

View rsbohn's full-sized avatar

Randall Bohn rsbohn

  • Rando Media
  • Orem Utah USA
View GitHub Profile
Wired to the SPI headers (plus D5)
fram metro_m4 color
Vin 5v red
...
Gnd Gnd black
SCK SCK white
MISO MISO brown
MOSI MOSI orange
CS D5 blue (socket-pin)
...
@rsbohn
rsbohn / dtmf.py
Created January 15, 2022 15:33
phone tones
# SPDX-FileCopyrightText: Copyright (c) 2021 Randall Bohn (dexter)
#
# SPDX-License-Identifier: MIT
#
# https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling
import array
import math
from audiocore import RawSample
tone_row = [697, 770, 852, 942]
@rsbohn
rsbohn / CircuitPython2022.txt
Created January 5, 2022 00:58
Looking forward
#CircuitPython2022
For the Broadcom ports I would really like to have an onboard editor.
Something simple that would allow for stand-alone coding beyond what you can do on the REPL.
I would also like to explore the possibilities and limitations of MIDI on CircuitPython.
Dexter Starboard 2022-01-04
@rsbohn
rsbohn / crystal.py
Created December 26, 2021 22:04
Put a simulated text LCD on your displayio screen.
# SPDX-FileCopyrightText: Copyright (c) 2021 Randall Bohn (dexter)
#
# SPDX-License-Identifier: MIT
"""LCD Widget"""
import time
import displayio
import terminalio
CHARS = 1
ROWS = 1
@rsbohn
rsbohn / singularity.py
Created December 18, 2021 22:06
singularity animation for bubbles.py
# just add this to bubbles.py
# then call it instead of herd()
def singularity(group):
cx = display.width//2
cy = display.height//2
for shape in group:
dx = max(1, int(math.sqrt(abs(cx-shape.x))))
if shape.x > cx: shape.x -= dx
else: shape.x += dx
@rsbohn
rsbohn / snowflakes.py
Created December 6, 2021 22:14
another displayio demo
# SPDX-FileCopyrightText: Copyright (c) 2021 Randall Bohn (dexter)
#
# SPDX-License-Identifier: MIT
"""snowflakes"""
# like bubbles but they fall from they sky
# circup install adafruit_display_shapes
# circup install adafruit_fancyled
import random
import time
import displayio
@rsbohn
rsbohn / bubbleface.py
Created December 5, 2021 15:56
Put bubbles on your face (LED Glasses)
# SPDX-FileCopyrightText: Copyright (c) 2021 Randall Bohn (dexter)
#
# SPDX-License-Identifier: MIT
"""Bubbles on your face (LED Glasses)"""
# circup install adafruit_display_shapes
# circup install adafruit_fancyled
import random
import time
import displayio
@rsbohn
rsbohn / bubbles.py
Created December 4, 2021 15:45
another displayio demo
# SPDX-FileCopyrightText: Copyright (c) 2021 Randall Bohn (dexter)
#
# SPDX-License-Identifier: MIT
"""Bubbles"""
# circup install adafruit_display_shapes
# circup install adafruit_fancyled
import random
import time
import displayio
import framebufferio
@rsbohn
rsbohn / terminal_vt100.py
Created December 3, 2021 16:20
terminalio demo
# SPDX-FileCopyrightText: Copyright (c) 2021 Randall Bohn (dexter)
#
# SPDX-License-Identifier: MIT
"""
Demonstrate usage of the terminalio module.
The module provides a VT100 emulation within a displayo.TileGrid.
A good reference for VT100 "escape" codes is found at
https://www.csie.ntu.edu.tw/~r92094/c++/VT100.html
"""
@rsbohn
rsbohn / color_gradient_rgb.py
Last active December 2, 2021 05:26
Colors in RGB Space
import time
import board
import displayio
display = board.DISPLAY
splash = displayio.Group()
display.show(splash)
n_colors = 8
palette = displayio.Palette(n_colors)