Skip to content

Instantly share code, notes, and snippets.

@rowena-s
rowena-s / CandyCane.py
Last active December 19, 2020 02:24
Sense Hat Christmas lights
from sense_hat import SenseHat
from time import sleep
sense = SenseHat()
R = (255, 0, 0)
B = (0,0,0)
W = (255,255,255)
cc_1 = [
B, B, R, W, W, R, B, B,
B, R, W, W, R, W, R, B,
B, W, R, B, B, W, W, B,
@rowena-s
rowena-s / code.py
Created September 6, 2020 00:41
Curlyboi code using play_tone instead of sample files
from adafruit_circuitplayground.express import cp
from time import sleep
#define your things because magic numbers are bad
G3 = 196
A3 = 200
C4 = 262
D4 = 294
E4 = 330
G4 = 392
@rowena-s
rowena-s / code.py
Last active September 6, 2020 00:45
Code for Wearing Your Python and Making It Sing Too! 2020 #pyconlineau talk
#instrument samples can be obtained from https://philharmonia.co.uk/resources/sound-samples/
#file conversion instructions: https://learn.adafruit.com/microcontroller-compatible-audio-file-conversion
from adafruit_circuitplayground.express import cpx
from time import sleep
cpx.pixels.brightness = 0.1
ctr = 0
while True:
@rowena-s
rowena-s / MicroScale.js
Last active October 8, 2019 13:10
8 notes, 3 pins, 2 buttons. What do?
/*
JavaScript code to play a C major scale on the microbit. Pin0 is reserved for the sound output device.
So really we have 2 pins and 2 buttons
P1 = C3, P2 = D3, A = E3, B = F3, A+P1=G3 A+P2 =A3 , B+P1 =B3 , B+P2=C4 (values in code are actually hz)
########################
Copy the code below into https://makecode.microbit.org/#editor in Javascript mode.
You can switch to Blocks mode if you're not comfortable with Javscript code.
*/
@rowena-s
rowena-s / 01-Roro-SydTalk.md
Last active September 10, 2019 12:06
Code Snippets and links for rorosyd SonicPi talk