I'm currently building the Dark Saber DIY following the instructions listed on this website. So far in my research I've only seen videos of the saber igniting with sound. But when it is turned off its like flipping a light switch and just turns off with no sounds. I'm new to this coding so is there a way to add a code to gradually turn off the neo pixels from blade tip to hilt and add an "off" sound.
Thanks in advanced.
Dark Saber - Powering off effects and sounds
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Blackmagic1138
- Posts: 2
- Joined: Tue Sep 07, 2021 8:41 pm
- Blackmagic1138
- Posts: 2
- Joined: Tue Sep 07, 2021 8:41 pm
Re: Dark Saber - Powering off effects and sounds
I found code from the Prop-maker lightsaber build. Hoping that I can use this to animate the blade when turned on/off and play both sounds as well.
Code: Select all
# Main program loop, repeats indefinitely
while True:
red_led.value = True
if not switch.value: # button pressed?
if mode == 0: # If currently off...
enable.value = True
power('on', 1.7, False) # Power up!
play_wav('idle', loop=True) # Play background hum sound
mode = 1 # ON (idle) mode now
else: # else is currently on...
power('off', 1.15, True) # Power down
mode = 0 # OFF mode now
enable.value = False
while not switch.value: # Wait for button release
time.sleep(0.2) # to avoid repeated triggering
Please be positive and constructive with your questions and comments.