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
@rsbohn
rsbohn / README.md
Created September 3, 2022 20:14
Exploring the CircuitPython 8 Web Workflow

Command Line access to CircuitPython 8 Web Workflow

via HTTPie

Hello? Are you there?

$ http http://circuitpython.local

HTTP/1.1 307 Temporary Redirect

Access-Control-Allow-Credentials: true

# SPDX-FileCopyrightText: Copyright (c) 2022 Randall Bohn (dexter)
#
# SPDX-License-Identifier: MIT
import math
import time
from vectorio import Circle
import displayio
import board
display = board.DISPLAY
@rsbohn
rsbohn / confusion-flat.csv
Last active September 5, 2022 02:35
Sample Confusion Matrix for Fruit Classifier
actual prediction n
apple apple 445
banana apple 0
date apple 0
fig apple 0
guava apple 0
mango apple 0
orange apple 0
pear apple 0
apple banana 1
@rsbohn
rsbohn / turtlefun.py
Created August 24, 2022 11:45
Random Turtle Art
# SPDX-FileCopyrightText: Copyright (c) 2022 Randall Bohn (dexter)
#
# SPDX-License-Identifier: MIT
"Random Turtle Art"
import random
from adafruit_turtle import turtle, Color
colors = [Color.RED, Color.YELLOW, Color.GREEN]
def walk(t,n):
t.forward(n)
@rsbohn
rsbohn / clicktrack.py
Created March 14, 2022 20:02
Asyncio and MIDI
import asyncio
import board
import time
import usb_midi
import adafruit_midi
from adafruit_midi.note_on import NoteOn
from adafruit_midi.note_off import NoteOff
from neopixel import NeoPixel
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.analoginput import AnalogInput
@rsbohn
rsbohn / readme.txt
Created February 19, 2022 17:26
ATtiny817 Morse Key
Turns the Adafruit ATtiny817 breakout into a Morse code output peripheral.
All registers are 16 bits.
Registers
00 Character Rate
01 Word Rate
02 Frequency
03 Duty Cycle
Busy pin
# SPDX-FileCopyrightText: Copyright (c) 2022 Randall Bohn (dexter)
#
# SPDX-License-Identifier: MIT
#
# View random products from Adafruit on the PyPortal
from random import randrange
from adafruit_pyportal import PyPortal
base_url = "https://adafruit.com/api/product/"
portal = PyPortal(
@rsbohn
rsbohn / visible_pin.py
Created January 17, 2022 20:01
Visible state of digital input pins.
# SPDX-FileCopyrightText: Copyright (c) 2022 Randall Bohn (dexter)
#
# SPDX-License-Identifier: MIT
# A little fun in the Funhouse
import time
import board
import digitalio
import displayio
import vectorio
from adafruit_displayio_layout.layouts.grid_layout import GridLayout
Connect UART and SPI0 between to Pi devices.
[3v3] :: [5v]
GPIO2 [CTS] :: [5v]
GPIO3 [RTS] :: [Gnd]
GPIO4 [TXD?] :: GPIO14 [TXD*]
[Gnd] :: GPIO15 [RXD*]
GPIO17 [RTS] :: GPIO18
GPIO27 :: [Gnd]
@rsbohn
rsbohn / roller.py
Last active January 15, 2022 17:36
# SPDX-FileCopyrightText: Copyright (c) 2022 Randall Bohn (dexter)
#
# SPDX-License-Identifier: MIT
#
# Dice Roller
# Runs on Feather Bluefruit Sense nRF52840
# faces: a 336x48 sprite sheet
import board
import time
import displayio