Skip to content

Commit

Permalink
Merge pull request #2955 from caternuson/hallo_jump_update
Browse files Browse the repository at this point in the history
Update HalloWing jump sound
  • Loading branch information
caternuson authored Jan 25, 2025
2 parents 38f661b + f70eaa5 commit c9f2d95
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
17 changes: 15 additions & 2 deletions Hallowing_Jump_Sound/jump-sound/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,21 @@ def play_wav(wav):
i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
if IS_HALLOWING_M4:
import adafruit_msa301
ACCEL = adafruit_msa301.MSA301(i2c)
# i2c scan to determine which accelo
while not i2c.try_lock():
pass
ADDR = i2c.scan()
i2c.unlock()
if 0x26 in ADDR:
# MSA301
from adafruit_msa3xx import MSA301
ACCEL = MSA301(i2c)
elif 0x62 in ADDR:
# MSA311
from adafruit_msa3xx import MSA311
ACCEL = MSA311(i2c)
else:
raise RuntimeError("Accelerometer not found.")
else:
import adafruit_lis3dh
try:
Expand Down
17 changes: 15 additions & 2 deletions Hallowing_Jump_Sound/stomp-and-roar/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,21 @@ def load_wav(name):
i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
if IS_HALLOWING_M4:
import adafruit_msa301
ACCEL = adafruit_msa301.MSA301(i2c)
# i2c scan to determine which accelo
while not i2c.try_lock():
pass
ADDR = i2c.scan()
i2c.unlock()
if 0x26 in ADDR:
# MSA301
from adafruit_msa3xx import MSA301
ACCEL = MSA301(i2c)
elif 0x62 in ADDR:
# MSA311
from adafruit_msa3xx import MSA311
ACCEL = MSA311(i2c)
else:
raise RuntimeError("Accelerometer not found.")
else:
import adafruit_lis3dh
try:
Expand Down

0 comments on commit c9f2d95

Please sign in to comment.