Skip to content

Instantly share code, notes, and snippets.

@gamblor21
gamblor21 / drums.py
Created May 31, 2023 23:53
Drums for Circuitpython synthio
import ulab.numpy as np
import random
import synthio
SAMPLE_SIZE = 200
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)
@ukmoose
ukmoose / README.md
Last active December 31, 2022 14:00
Get Devices - Ikea Home smart - Dirigera

This is an Unofficial Proof of concept to link the new Ikea Dirigera gateway with Node-Red

Based on https://github.com/mattias73andersson/dirigera-client-poc

...and remember, this is proof-of-concept to test the local interface of the IKEA Dirigera gateway. Allows simple control of a light (On/Off,Dim) and an Outlet (On/Off)

The purpose was just to see if it was possible to connect to the gateway. There's not much error checking

Other endpoints of the Dirigera gateway can be found by decompiling the IKEA Smart Home App. Totally unofficial, not affiliated with IKEA in any way.

@anecdata
anecdata / code.py
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
@todbot
todbot / staroids_tilegrid_code.py
Last active August 14, 2021 23:49
fake Almost Asteroids, using CircuitPython and displayio.TileGrid()
# staroids_tilegrid_code.py -- fakey Almost Asteroids
# 4 Aug 2021 - @todbot
import board, time, math, random
import displayio, terminalio, bitmaptools
import adafruit_imageload
import digitalio
num_roids = 4 # how many asteroids do you want
@rhooper
rhooper / Create-rotating-sprite.ipynb
Created May 17, 2021 18:10
Jupter Notebook to create rotating logo sprite strips.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jfurcean
jfurcean / controls.py
Created February 7, 2021 16:09
space invaders nunchuk controls
import board
import digitalio
import analogio
import audioio
import audiocore
from wiichuck.nunchuk import Nunchuk
B_X = 0x01
B_O = 0x02
@wildestpixel
wildestpixel / code.py
Created February 6, 2021 18:30
Pimoroni Pico Display Pack Circuitpython 6.2 b1 running code
"""
adapted from http://helloraspberrypi.blogspot.com/2021/01/raspberry-pi-picocircuitpython-st7789.html
"""
import os
import board
import time
import terminalio
import displayio
import busio
@antonizoon
antonizoon / code.py
Last active February 1, 2021 21:31
bb10keyboard_hid
# based on the example here, needs the same libraries https://github.com/arturo182/keyboard_featherwing_sw/tree/master/circuitpython
# also drop in the adafruit_hid library. basically just added keyboard send ability when it displays to the screen
# as per the README: https://github.com/adafruit/Adafruit_CircuitPython_HID
#
# HID Keyboard functionality could be improved. Currently it sends the current line to the UART Output terminal as a log
# but it might be better to just remove the UART functionality as it adds lag.
from bbq10keyboard import BBQ10Keyboard, STATE_PRESS, STATE_RELEASE, STATE_LONG_PRESS
from adafruit_display_text.label import Label
from adafruit_display_shapes.rect import Rect
import adafruit_ili9341
@ladyada
ladyada / code.py
Created November 9, 2020 01:11
CircuitPython Countdown for MagTag Demo
import sys
import time
import board
import wifi
import socketpool
import adafruit_requests
import ssl
import rtc
import displayio
import terminalio
@sandyjmacdonald
sandyjmacdonald / usb-midi-cc-controller.ino
Created October 2, 2020 18:53
USB MIDI CC controller with Adafruit Trinket M0 and Pimoroni Potentiometer Breakout.
// USB MIDI CC controller with Trinket M0 and Pimoroni Potentiometer Breakout.
// Adapted from Chris Parrot's Potentiometer example.
#include <IOExpander.h>
#include <Adafruit_DotStar.h>
#include <MIDIUSB.h>
// Global constants
static const unsigned int DELAY_MS = 1000 / 30;