diff --git a/Feather_ePaper_Quotes/adafruit_feather_quote/secrets.h b/Feather_ePaper_Quotes/adafruit_feather_quote/secrets.h index f19b6e42f..6d86c1928 100644 --- a/Feather_ePaper_Quotes/adafruit_feather_quote/secrets.h +++ b/Feather_ePaper_Quotes/adafruit_feather_quote/secrets.h @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: MIT -#ifndef _SECRET_H THEN +#ifndef _SECRET_H #define _SECRET_H // define your WIFI SSID and password in this file diff --git a/HAL9000_RP2040_PropMaker/code.py b/HAL9000_RP2040_PropMaker/code.py new file mode 100755 index 000000000..3251b16f8 --- /dev/null +++ b/HAL9000_RP2040_PropMaker/code.py @@ -0,0 +1,79 @@ +# SPDX-FileCopyrightText: 2023 Phil Burgess for Adafruit Industries +# +# SPDX-License-Identifier: MIT + +""" +HAL 9000 demo project for Adafruit Prop Maker Feather RP2040 and "Massive +Arcade Button with LED - 100mm red." This simply monitors for button presses +and then randomly plays one WAV file from the CIRCUITPY filesystem. +No soldering required; using quick-connects, LED and button can be wired +to screw terminals on the Prop Maker Feather board. +NOTE: WAV FILES MUST BE 16-BIT. This will be fixed (allowing 8-bit WAVs if +desired) in CircuitPython 9.0. +""" + +# pylint: disable=import-error +import os +import random +import time +import audiocore +import audiobusio +import board +import digitalio +import pwmio + + +# HARDWARE SETUP ----------------------------------------------------------- + +# LED+ is wired to "Neo" pin on screw terminal header, LED- to GND. +# The LED inside the button is NOT a NeoPixel, just a normal passive LED, +# but that's okay here -- the "Neo" pin can also function like a simple +# 5V digital output or PWM pin. +led = pwmio.PWMOut(board.EXTERNAL_NEOPIXELS) +led.duty_cycle = 65535 # LED ON by default + +# Button is wired to GND and "Btn" on screw terminal header: +button = digitalio.DigitalInOut(board.EXTERNAL_BUTTON) +button.direction = digitalio.Direction.INPUT +button.pull = digitalio.Pull.UP + +# Enable power to audio amp, etc. +external_power = digitalio.DigitalInOut(board.EXTERNAL_POWER) +external_power.direction = digitalio.Direction.OUTPUT +external_power.value = True + +# I2S audio out +audio = audiobusio.I2SOut(board.I2S_BIT_CLOCK, board.I2S_WORD_SELECT, board.I2S_DATA) + +# Find all Wave files in CIRCUITPY storage: +wavefiles = [ + file + for file in os.listdir("/sounds/") + if (file.endswith(".wav") and not file.startswith("._")) +] +print("Audio files found:", wavefiles) + +# FUNCTIONS ---------------------------------------------------------------- + + +def play_file(filename): + """Plays a WAV file in its entirety (function blocks until done).""" + print("Playing", filename) + with open(f"/sounds/{filename}", "rb") as file: + audio.play(audiocore.WaveFile(file)) + # Randomly flicker the LED a bit while audio plays + while audio.playing: + led.duty_cycle = random.randint(5000, 30000) + time.sleep(0.1) + led.duty_cycle = 65535 # Back to full brightness + + +# MAIN LOOP ---------------------------------------------------------------- + + +# Loop simply watches for a button press (button pin pulled to GND, thus +# False) and then plays a random WAV file. Because the WAV-playing function +# will take a few seconds, this doesn't even require button debouncing. +while True: + if button.value is False: + play_file(random.choice(wavefiles)) diff --git a/HAL9000_RP2040_PropMaker/sounds/HAL.wav b/HAL9000_RP2040_PropMaker/sounds/HAL.wav new file mode 100644 index 000000000..f7ef618ef Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/HAL.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/fault.wav b/HAL9000_RP2040_PropMaker/sounds/fault.wav new file mode 100644 index 000000000..d6ea6df9d Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/fault.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/goodbye.wav b/HAL9000_RP2040_PropMaker/sounds/goodbye.wav new file mode 100644 index 000000000..d504d8d34 Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/goodbye.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/info.wav b/HAL9000_RP2040_PropMaker/sounds/info.wav new file mode 100644 index 000000000..baab1ab20 Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/info.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/mission.wav b/HAL9000_RP2040_PropMaker/sounds/mission.wav new file mode 100644 index 000000000..5d8320e03 Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/mission.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/moment.wav b/HAL9000_RP2040_PropMaker/sounds/moment.wav new file mode 100644 index 000000000..2040e3fe1 Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/moment.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/printing.wav b/HAL9000_RP2040_PropMaker/sounds/printing.wav new file mode 100644 index 000000000..8b12a5dfc Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/printing.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/puzzling.wav b/HAL9000_RP2040_PropMaker/sounds/puzzling.wav new file mode 100644 index 000000000..e003e759b Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/puzzling.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/python.wav b/HAL9000_RP2040_PropMaker/sounds/python.wav new file mode 100644 index 000000000..5283cfd74 Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/python.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/reload.wav b/HAL9000_RP2040_PropMaker/sounds/reload.wav new file mode 100644 index 000000000..a3566c251 Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/reload.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/repl.wav b/HAL9000_RP2040_PropMaker/sounds/repl.wav new file mode 100644 index 000000000..2cb9060b4 Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/repl.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/serious.wav b/HAL9000_RP2040_PropMaker/sounds/serious.wav new file mode 100644 index 000000000..08dacfeba Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/serious.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/silly.wav b/HAL9000_RP2040_PropMaker/sounds/silly.wav new file mode 100644 index 000000000..67ec2d41e Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/silly.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/sorry.wav b/HAL9000_RP2040_PropMaker/sounds/sorry.wav new file mode 100644 index 000000000..63c5f2522 Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/sorry.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/state.wav b/HAL9000_RP2040_PropMaker/sounds/state.wav new file mode 100644 index 000000000..f3ff9b19c Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/state.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/what.wav b/HAL9000_RP2040_PropMaker/sounds/what.wav new file mode 100644 index 000000000..3fabd77d1 Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/what.wav differ diff --git a/HAL9000_RP2040_PropMaker/sounds/zero.wav b/HAL9000_RP2040_PropMaker/sounds/zero.wav new file mode 100644 index 000000000..cc6ac7786 Binary files /dev/null and b/HAL9000_RP2040_PropMaker/sounds/zero.wav differ diff --git a/Matrix_Portal_S3_Message_Board/lib/messageboard/doublebuffer.py b/Matrix_Portal_S3_Message_Board/lib/messageboard/doublebuffer.py index b53b62e81..998a5a624 100755 --- a/Matrix_Portal_S3_Message_Board/lib/messageboard/doublebuffer.py +++ b/Matrix_Portal_S3_Message_Board/lib/messageboard/doublebuffer.py @@ -37,7 +37,7 @@ def __init__(self, display, width, height, shader=None, bit_depth=16): self._buffer_group[1].append(buffer1_sprite) def show(self, swap=True): - self.display.show(self._buffer_group[self._active_buffer]) + self.display.root_group = self._buffer_group[self._active_buffer] if swap: self.swap()