Skip to content

Commit 65a3363

Browse files
authored
Merge branch 'master' into master
2 parents 31c60a0 + bf56c97 commit 65a3363

File tree

8 files changed

+155
-2
lines changed

8 files changed

+155
-2
lines changed

CLUE_Altimeter/clue_altimeter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
clue._pressure.standby_period = 0x01 # 62.5 ms
3131

3232
# restore saved sea level pressure from NVM
33-
clue.sea_level_pressure = struct.unpack("f", nvm[0:4])[0]
33+
slp = struct.unpack("f", nvm[0:4])[0]
34+
clue.sea_level_pressure = slp if 0 < slp < 2000 else STD_SLP
3435

3536
# --------------------------------------------------------------------
3637
# D I S P L A Y S E T U P

MIDI_Solenoid_Drum_Kit/code.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import time
2+
import board
3+
import digitalio
4+
import usb_midi
5+
import adafruit_midi
6+
from adafruit_midi.note_on import NoteOn
7+
8+
# pins for the solenoid output signals
9+
noid_pins = [board.D5, board.D6, board.D9, board.D10]
10+
11+
# array for the solenoids
12+
noids = []
13+
14+
# setup for the solenoid pins to be outputs
15+
for pin in noid_pins:
16+
noid = digitalio.DigitalInOut(pin)
17+
noid.direction = digitalio.Direction.OUTPUT
18+
noids.append(noid)
19+
20+
# MIDI note array
21+
notes = [60, 61, 62, 63]
22+
23+
# MIDI in setup
24+
midi = adafruit_midi.MIDI(midi_in=usb_midi.ports[0], in_channel=0)
25+
26+
# delay for solenoids
27+
speed = 0.03
28+
retract = 0
29+
30+
while True:
31+
32+
# msg holds MIDI messages
33+
msg = midi.receive()
34+
35+
for i in range(4):
36+
# states for solenoid on/off
37+
noid_output = noids[i]
38+
39+
# states for MIDI note recieved
40+
notes_played = notes[i]
41+
42+
# if NoteOn msg comes in and the MIDI note # matches with predefined notes:
43+
if isinstance(msg, NoteOn) and msg.note is notes_played:
44+
print(time.monotonic(), msg.note)
45+
46+
# solenoid is triggered
47+
noid_output.value = True
48+
# quick delay
49+
retract = time.monotonic()
50+
51+
# retracts solenoid using time.monotonic() to avoid delays between notes activating
52+
if (retract + speed) < time.monotonic():
53+
noid_output.value = False

MP3_Tap_Player/mp3_tap_player.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# MP3 playback with tap trigger
2-
# Works on M4 and nRF52840 based boards with accelerometer or Propmaker
2+
# Works on Feather M4 (or other M4 based boards) with Propmaker
33
import time
44
import board
55
import busio

PyRuler_Video_Panic/PyRuler_Base.stl

309 KB
Binary file not shown.
7.7 KB
Binary file not shown.

PyRuler_Video_Panic/PyRuler_Cover.stl

67.5 KB
Binary file not shown.

PyRuler_Video_Panic/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# PyRuler Video Conference Panic Buttons
2+
3+
To be replaced with a link to the guide once published...

PyRuler_Video_Panic/code.py

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import os
2+
import board
3+
from digitalio import DigitalInOut, Direction
4+
import time
5+
import touchio
6+
7+
# Set this to True to turn the touchpads into a keyboard
8+
ENABLE_KEYBOARD = True
9+
10+
# Used if we do HID output, see below
11+
if ENABLE_KEYBOARD:
12+
from adafruit_hid.keyboard import Keyboard
13+
from adafruit_hid.keycode import Keycode
14+
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
15+
kbd = Keyboard()
16+
layout = KeyboardLayoutUS(kbd)
17+
18+
#print(dir(board), os.uname()) # Print a little about ourselves
19+
20+
led = DigitalInOut(board.D13)
21+
led.direction = Direction.OUTPUT
22+
23+
touches = [DigitalInOut(board.CAP0)]
24+
for p in (board.CAP1, board.CAP2, board.CAP3):
25+
touches.append(touchio.TouchIn(p))
26+
27+
leds = []
28+
for p in (board.LED4, board.LED5, board.LED6, board.LED7):
29+
led = DigitalInOut(p)
30+
led.direction = Direction.OUTPUT
31+
led.value = True
32+
time.sleep(0.25)
33+
leds.append(led)
34+
for led in leds:
35+
led.value = False
36+
37+
38+
cap_touches = [False, False, False, False]
39+
40+
def read_caps():
41+
t0_count = 0
42+
t0 = touches[0]
43+
t0.direction = Direction.OUTPUT
44+
t0.value = True
45+
t0.direction = Direction.INPUT
46+
# funky idea but we can 'diy' the one non-hardware captouch device by hand
47+
# by reading the drooping voltage on a tri-state pin.
48+
t0_count = t0.value + t0.value + t0.value + t0.value + t0.value + \
49+
t0.value + t0.value + t0.value + t0.value + t0.value + \
50+
t0.value + t0.value + t0.value + t0.value + t0.value
51+
cap_touches[0] = t0_count > 2
52+
cap_touches[1] = touches[1].raw_value > 3000
53+
cap_touches[2] = touches[2].raw_value > 3000
54+
cap_touches[3] = touches[3].raw_value > 3000
55+
return cap_touches
56+
57+
while True:
58+
caps = read_caps()
59+
print(caps)
60+
# light up the matching LED
61+
for i,c in enumerate(caps):
62+
leds[i].value = c
63+
if caps[0]:
64+
if ENABLE_KEYBOARD:
65+
# Zoom
66+
kbd.press(Keycode.ALT, Keycode.V)
67+
kbd.release(Keycode.V)
68+
time.sleep(0.25)
69+
kbd.press(Keycode.A)
70+
kbd.release_all()
71+
if caps[1]:
72+
if ENABLE_KEYBOARD:
73+
# Teams
74+
# Note that video toggle doesn't work in the web app
75+
kbd.press(Keycode.CONTROL, Keycode.SHIFT, Keycode.M)
76+
kbd.release(Keycode.M)
77+
time.sleep(0.5)
78+
kbd.press(Keycode.O)
79+
kbd.release_all()
80+
if caps[2]:
81+
if ENABLE_KEYBOARD:
82+
# Skype
83+
kbd.press(Keycode.CONTROL, Keycode.M)
84+
kbd.release(Keycode.M)
85+
time.sleep(0.5)
86+
kbd.press(Keycode.SHIFT, Keycode.K)
87+
kbd.release_all()
88+
if caps[3]:
89+
if ENABLE_KEYBOARD:
90+
# Jitsi
91+
kbd.press(Keycode.M)
92+
kbd.release(Keycode.M)
93+
time.sleep(0.5)
94+
kbd.press(Keycode.V)
95+
kbd.release_all()
96+
time.sleep(.2)

0 commit comments

Comments
 (0)