# Make a Zelda Master Sword with the RP2040 Prop-Maker Feather

## Overview

https://youtu.be/F4ooEzrY8LE

Build the sword that seals the darkness and defend your kingdom with Adafruit's RP2040 Prop-Maker Feather!

This iconic Zelda sword has been upgraded to be much easier to build and the assembly is even more durable.

The new dev board packs all of the features into one making this project even more enjoyable to build!

&nbsp;

![led_strips_master-sword-blast-loop.gif](https://cdn-learn.adafruit.com/assets/assets/000/123/374/medium640thumb/led_strips_master-sword-blast-loop.jpg?1691502358)

![led_strips_hero-sword-hold-side.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/375/medium640/led_strips_hero-sword-hold-side.jpg?1691502425)

## Prop-Maker Feather

The Prop-Maker Feather was designed for creating advanced props using motion, lights and sound. The **LIS3DH** accelerometer can detect steps, swings and hits. It has an on-board **class-D audio amp** for blasting sound effects. For creating stunning lighting effects, the built-in **NeoPixel driver** is&nbsp;essential.

**Terminal Block Port -** With easy-to-use screw terminals, you can quickly connect and disconnect, lights, speakers and buttons!

![led_strips_hero-board.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/376/medium640/led_strips_hero-board.jpg?1691502503)

![led_strips_hero-up-wide.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/377/medium640/led_strips_hero-up-wide.jpg?1691502647)

The CircuitPython code has been revised to handle the new pinouts, and features adjustable settings for the accelerometer and NeoPixels.

We think this is a great resource for building similar props that feature motion-activated effects with LED animations.

&nbsp;

![led_strips_cp-code.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/378/medium640/led_strips_cp-code.jpg?1691505017)

![led_strips_hero-walk.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/379/medium640/led_strips_hero-walk.jpg?1691505060)

![](https://cdn-learn.adafruit.com/assets/assets/000/123/380/medium800/led_strips_hero-peace.jpg?1691505091)

## Parts
![](https://cdn-learn.adafruit.com/assets/assets/000/123/381/medium800/led_strips_parts.jpg?1691505124)

### Adafruit RP2040 Prop-Maker Feather with I2S Audio Amplifier

[Adafruit RP2040 Prop-Maker Feather with I2S Audio Amplifier](https://www.adafruit.com/product/5768)
The Adafruit Feather series gives you lots of options for a small, portable, rechargeable microcontroller board. By picking a feather and stacking on a FeatherWing you can create advanced projects quickly. One popular combo is our [Feather M4](https://www.adafruit.com/product/3857)...

In Stock
[Buy Now](https://www.adafruit.com/product/5768)
[Related Guides to the Product](https://learn.adafruit.com/products/5768/guides)
![Video of a white hand pressing a button to briefly turn an LED strip into white lights. Also wired up to the microcontroller are a servo motor and a speaker.](https://cdn-shop.adafruit.com/product-videos/640x480/5768-09.jpg)

### Adafruit Mini Skinny NeoPixel Digital RGB LED Strip - 144 LED/m

[Adafruit Mini Skinny NeoPixel Digital RGB LED Strip - 144 LED/m](https://www.adafruit.com/product/2969)
So thin. So mini. So teeeeeeny-tiny. It's the 'skinny' version of our classic NeoPixel strips!

These NeoPixel strips have 144 digitally-addressable pixel Mini LEDs per meter and are very affordable and are only 7.5 mm wide (0.3")&nbsp;if you remove the strip from the...

In Stock
[Buy Now](https://www.adafruit.com/product/2969)
[Related Guides to the Product](https://learn.adafruit.com/products/2969/guides)
![Adafruit NeoPixel Digital RGB LED Strip with all the LEDs in a rainbow](https://cdn-shop.adafruit.com/product-videos/640x480/2969-04.jpg)

### Lithium Ion Cylindrical Battery - 3.7v 2200mAh

[Lithium Ion Cylindrical Battery - 3.7v 2200mAh](https://www.adafruit.com/product/1781)
Need a big battery for your project? This lithium-ion battery contains a 2200mAh and a protection circuit that provides over-voltage, under-voltage, and over-current protection. Yet, it is slim and easy to fit into many project cases.  
  
This cell can provide 2 **C** of...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1781)
[Related Guides to the Product](https://learn.adafruit.com/products/1781/guides)
![Lithium Ion Cylindrical Battery - 3.7v 2200mAh with JST PH connector](https://cdn-shop.adafruit.com/640x480/1781-04.jpg)

### JST-PH Battery Extension Cable - 500mm

[JST-PH Battery Extension Cable - 500mm](https://www.adafruit.com/product/1131)
By popular demand, we now have a handy extension cord for all of our JST PH-terminated battery packs (such as our LiIon/LiPoly and 3xAAA holders). One end has a JST-PH compatible socket, and the other end has a matching plug. Between the two, 500mm of color coded wire. Handy for wearable...

In Stock
[Buy Now](https://www.adafruit.com/product/1131)
[Related Guides to the Product](https://learn.adafruit.com/products/1131/guides)
![Front shot of JST-PH Battery Extension Cable.](https://cdn-shop.adafruit.com/640x480/1131-00.jpg)

### Mini Oval Speaker with Short Wires - 8 Ohm 1 Watt

[Mini Oval Speaker with Short Wires - 8 Ohm 1 Watt](https://www.adafruit.com/product/4227)
Hear the good news! This wee speaker&nbsp;is&nbsp;a&nbsp;great addition to any audio project where you need 8 ohm impedance and 1W or less of power. We particularly like this&nbsp;speaker&nbsp;as it is&nbsp;small and comes with nice skinny wires with a connector on the end. It has a handy...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4227)
[Related Guides to the Product](https://learn.adafruit.com/products/4227/guides)
![Mini Oval Speaker with Short Wires ](https://cdn-shop.adafruit.com/640x480/4227-06.jpg)

### Breadboard-friendly SPDT Slide Switch

[Breadboard-friendly SPDT Slide Switch](https://www.adafruit.com/product/805)
These nice switches are perfect for use with breadboard and perfboard projects. They have 0.1" spacing and snap in nicely into a solderless breadboard. They're easy to switch no matter what size fingers you have, but not so easy that they'll get flipped by accident. Work great as...

In Stock
[Buy Now](https://www.adafruit.com/product/805)
[Related Guides to the Product](https://learn.adafruit.com/products/805/guides)
![Small, black, SPDT slide switch.](https://cdn-shop.adafruit.com/640x480/805-03.jpg)

### Part: JST PH 2-Pin Cable - Female Connector 100mm
quantity: 1
JST PH 2-Pin Cable - Female Connector 100mm
[JST PH 2-Pin Cable - Female Connector 100mm](https://www.adafruit.com/product/261)

### Part: 1.25mm Pitch 2-pin Cable Matching Pair - 40cm long
quantity: 1
1.25mm Pitch 2-pin Cable Matching Pair - 40cm long
[1.25mm Pitch 2-pin Cable Matching Pair - 40cm long](https://www.adafruit.com/product/4720)

### Part: JST PH 2-Pin Cable - Female Connector 100mm
quantity: 1
JST PH 2-Pin Cable - Female Connector 100mm
[JST PH 2-Pin Cable - Female Connector 100mm](https://www.adafruit.com/product/261)

### Part: JST PH 2-Pin Cable – Male Header 200mm
quantity: 1
JST PH 2-Pin Cable – Male Header 200mm
[JST PH 2-Pin Cable – Male Header 200mm](https://www.adafruit.com/product/3814)

### Part: M2.5x5mm Screws
quantity: 8
M2.5x5mm Screws

### Part: M2.5x12mm Screws
quantity: 8
M2.5x12mm Screws

### Part: M3x20mm Screws
quantity: 12
M3x20mm Screws

# Make a Zelda Master Sword with the RP2040 Prop-Maker Feather

## Circuit Diagram

## Adafruit Library for Fritzing

The wiring diagram below provides a visual reference for connecting the components. It is not true to scale, it is just meant to be used as reference. This diagram was created using the [Fritzing software package](http://fritzing.org/download/).

Take a moment to review the components in the circuit diagram. This illustration is meant for referencing wired connections - the length of wire, position and size of components are not exact.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/123/390/medium800/led_strips_Master-Sword-Circui-Diagram.jpg?1691511532)

## Wired Connections

- The two NeoPixel strips (72 pixels each), and speaker are each connected to pins on the screw block terminal.
- The slide switch is connected to the EN and GND pins on the Feather.
- A 500mAh battery is connected to the battery port on the Feather via an 2 Pin JST extension cable.

![](https://cdn-learn.adafruit.com/assets/assets/000/123/393/medium800/led_strips_circuit-connections.jpg?1691520176)

# Make a Zelda Master Sword with the RP2040 Prop-Maker Feather

## 3D Printing

## Parts List

STL files for 3D printing are oriented to print "as-is" on FDM style machines. Parts are designed to 3D print without any support material. Original design source may be downloaded using the links below.

![led_strips_3d-parts.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/382/medium640/led_strips_3d-parts.jpg?1691505331)

![led_strips_3d-parts-blades.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/383/medium640/led_strips_3d-parts-blades.jpg?1691505415)

[Edit Design](https://a360.co/3ybOdZq)
[Download STLs](https://www.thingiverse.com/thing:6161367)
## Slice with Settings for PLA material&nbsp;

The parts were sliced using CURA using the slice settings below.

- PLA filament 220c extruder
- 0.2 layer height
- 10% gyroid infill
- 60mm/s print speed
- 60c heated bed

![led_strips_slice.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/385/medium640/led_strips_slice.jpg?1691505845)

## Supports

- Support Overhang Angle: 50
- Support Destiny: 6%
- Enable Support Interface
- Enable Support Roof
- Support Z Distance: .21

![led_strips_supports.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/386/medium640/led_strips_supports.jpg?1691505869)

## Share, Make, Remix

This master sword was originally designed by [Garrett Kearney](https://twitter.com/chaoscoretech) from [Chaos Core Tech (Youtube Channel)](https://www.youtube.com/channel/UCVmyytnqQrcTg1WRFXTo14Q)&nbsp;– The files are open to remix and feature nice details. The parts have been modified to fit all of the electronics and available to download. You can check out Garrett's [project build video on YouTube.](https://youtu.be/HRMcRFcPFsU).&nbsp;

Garrett's original design was modeled in [Autodesk Fusion 360](https://gallery.autodesk.com/fusion360/projects/master-sword--sheath-from-legend-of-zelda). It contains solid bodies, sketches and parametric feature timeline. It's a great resource to check out!&nbsp;

# Make a Zelda Master Sword with the RP2040 Prop-Maker Feather

## CircuitPython

[CircuitPython](https://github.com/adafruit/circuitpython) is a derivative of [MicroPython](https://micropython.org) designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the **CIRCUITPY** drive to iterate.

## CircuitPython Quickstart

Follow this step-by-step to quickly get CircuitPython running on your board.

[Download the latest version of CircuitPython for this board via circuitpython.org](https://circuitpython.org/board/adafruit_feather_rp2040_prop_maker/)
 **Click the link above to download the latest CircuitPython UF2 file.**

Save it wherever is convenient for you.

![install_circuitpython_on_rp2040_RP2040_UF2_downloaded.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/655/medium640/install_circuitpython_on_rp2040_RP2040_UF2_downloaded.jpg?1618943202)

![](https://cdn-learn.adafruit.com/assets/assets/000/121/865/medium800/adafruit_products_boot_reset.jpg?1686710555)

To enter the bootloader, hold down the **BOOT/**** BOOTSEL button**(highlighted in red above), and while continuing to hold it (don't let go!), press and release the**reset button**(highlighted in red or blue above).&nbsp;**Continue to hold the BOOT/BOOTSEL button until the RPI-RP2 drive appears!**

If the drive does not appear, release all the buttons, and then repeat the process above.

You can also start with your board unplugged from USB, press and hold the BOOTSEL button (highlighted in red above), continue to hold it while plugging it into USB, and wait for the drive to appear before releasing the button.

A lot of people end up using charge-only USB cables and it is very frustrating! **Make sure you have a USB cable you know is good for data sync.**

You will see a new disk drive appear called **RPI-RP2**.

&nbsp;

Drag the **adafruit\_circuitpython\_etc.uf2** file to **RPI-RP2.**

![install_circuitpython_on_rp2040_RP2040_bootloader_drive.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/656/medium640/install_circuitpython_on_rp2040_RP2040_bootloader_drive.jpg?1618943666)

![install_circuitpython_on_rp2040_RP2040_drag_UF2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/657/medium640/install_circuitpython_on_rp2040_RP2040_drag_UF2.jpg?1618943674)

The **RPI-RP2** drive will disappear and a new disk drive called **CIRCUITPY** will appear.

That's it, you're done! :)

![install_circuitpython_on_rp2040_RP2040_CIRCUITPY.jpg](https://cdn-learn.adafruit.com/assets/assets/000/101/658/medium640/install_circuitpython_on_rp2040_RP2040_CIRCUITPY.jpg?1618943864)

## Safe Mode

You want to edit your **code.py** or modify the files on your **CIRCUITPY** drive, but find that you can't. Perhaps your board has gotten into a state where **CIRCUITPY** is read-only. You may have turned off the **CIRCUITPY** drive altogether. Whatever the reason, safe mode can help.

Safe mode in CircuitPython does not run any user code on startup, and disables auto-reload. This means a few things. First, safe mode _bypasses any code in_ **boot.py** (where you can set **CIRCUITPY** read-only or turn it off completely). Second, _it does not run the code in_ **code.py**. And finally, _it does not automatically soft-reload when data is written to the_ **CIRCUITPY** _drive_.

Therefore, whatever you may have done to put your board in a non-interactive state, safe mode gives you the opportunity to correct it without losing all of the data on the **CIRCUITPY** drive.

### Entering Safe Mode
To enter safe mode when using CircuitPython, plug in your board or hit reset (highlighted in red above). Immediately after the board starts up or resets, it waits 1000ms. On some boards, the onboard status LED (highlighted in green above) will blink yellow during that time. If you press reset during that 1000ms, the board will start up in safe mode. It can be difficult to react to the yellow LED, so you may want to think of it simply as a slow double click of the reset button. (Remember, a fast double click of reset enters the bootloader.)

### In Safe Mode

If you successfully enter safe mode on CircuitPython, the LED will intermittently blink yellow three times.

If you connect to the serial console, you'll find the following message.

```terminal
Auto-reload is off.
Running in safe mode! Not running saved code.

CircuitPython is in safe mode because you pressed the reset button during boot. Press again to exit safe mode.

Press any key to enter the REPL. Use CTRL-D to reload.
```

You can now edit the contents of the **CIRCUITPY** drive. Remember, _your code will not run until you press the reset button, or unplug and plug in your board, to get out of safe mode._

## Flash Resetting UF2

If your board ever gets into a really _weird_ state and CIRCUITPY doesn't show up as a disk drive after installing CircuitPython, try loading this 'nuke' UF2 to RPI-RP2. which will do a 'deep clean' on your Flash Memory. **You will lose all the files on the board** , but at least you'll be able to revive it! After loading this UF2, follow the steps above to re-install CircuitPython.

[Download flash erasing "nuke" UF2](https://cdn-learn.adafruit.com/assets/assets/000/101/659/original/flash_nuke.uf2?1618945856)
# Make a Zelda Master Sword with the RP2040 Prop-Maker Feather

## Code

Once you've finished setting up your RP2040 Prop-Maker Feather with CircuitPython, you can access the code and necessary libraries by downloading the Project Bundle.

To do this, click on the **Download Project Bundle** button in the window below. It will download as a zipped folder.

![led_strips_cp-code-close.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/360/medium640/led_strips_cp-code-close.jpg?1691498927)

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/RP2040_Prop-Maker_Feather_Master_Sword/code.py

## Upload the Code and Libraries to the RP2040 Prop-Maker Feather

After downloading the Project Bundle, plug your RP2040 Prop-Maker Feather into the computer's USB port with a known good USB data+power cable. You should see a new flash drive appear in the computer's File Explorer or Finder (depending on your operating system) called **CIRCUITPY**. Unzip the folder and copy the following items to the RP2040 Prop-Maker Feather's **CIRCUITPY** drive.

- **lib** folder
- **sounds** folder
- **code.py**

Your RP2040 Prop-Maker Feather **CIRCUITPY** drive should look like this after copying the **lib** folder, **sounds** folder and the **code.py** file.

![CIRCUITPY](https://adafruit.github.io/Adafruit_Learning_System_Guides/RP2040_Prop-Maker_Feather_Master_Sword.png )

## How the CircuitPython Code Works

At the top of the code, you can customize a few attributes for your sword. `COLOR` and `ALT_COLOR` affect the NeoPixel color of the sword. `IDLE_PULSE_SPEED` and `SWING_BLAST_SPEED` affect the NeoPixel pulse speed. `IDLE_PULSE_BRIGHTNESS_MIN` and `_MAX` affect the NeoPixel brightness range. `HIT_THRESHOLD` and `SWING_THRESHOLD` affect the motion sensitivity of the sword.

```python
# CUSTOMISE COLORS HERE:
COLOR = (0, 120, 120)      # Default idle is light blue
ALT_COLOR = (255, 50, 0)  # hit color is orange

# CUSTOMISE IDLE PULSE SPEED HERE: 0 is fast, above 0 slows down
IDLE_PULSE_SPEED = 0  # Default is 0 seconds
SWING_BLAST_SPEED = 0.0007

# CUSTOMISE BRIGHTNESS HERE: must be a number between 0 and 1
IDLE_PULSE_BRIGHTNESS_MIN = 0.2  # Default minimum idle pulse brightness
IDLE_PULSE_BRIGHTNESS_MAX = 1  # Default maximum idle pulse brightness

# CUSTOMISE SENSITIVITY HERE: smaller numbers = more sensitive to motion
HIT_THRESHOLD = 250
SWING_THRESHOLD = 150
```

## NeoPixels, Audio and Accelerometer

The NeoPixels, I2S amp and accelerometer are instantiated.

```python
NUM_PIXELS = 73  # Number of pixels used in project
NEOPIXEL_PIN = board.EXTERNAL_NEOPIXELS

enable = digitalio.DigitalInOut(board.EXTERNAL_POWER)
enable.direction = digitalio.Direction.OUTPUT
enable.value = True

strip = neopixel.NeoPixel(NEOPIXEL_PIN, NUM_PIXELS, brightness=1, auto_write=False)
strip.fill(0)  # NeoPixels off ASAP on startup
strip.show()

# i2s audio
audio = audiobusio.I2SOut(board.I2S_BIT_CLOCK, board.I2S_WORD_SELECT, board.I2S_DATA)
wave_file = None

# Set up accelerometer on I2C bus, 4G range:
i2c = board.I2C()  # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C()  # For using the built-in STEMMA QT connector on a microcontroller
accel = adafruit_lis3dh.LIS3DH_I2C(i2c)
accel.range = adafruit_lis3dh.RANGE_4_G
```

## Functions

There are a few functions that are used throughout the loop. `play_wav()` plays the sound effects that are contained in the **/sounds** folder.

```python
def play_wav(name, loop=False):
    """
    Play a WAV file in the 'sounds' directory.
    :param name: partial file name string, complete name will be built around
                 this, e.g. passing 'foo' will play file 'sounds/foo.wav'.
    :param loop: if True, sound will repeat indefinitely (until interrupted
                 by another sound).
    """
    global wave_file  # pylint: disable=global-statement
    print("playing", name)
    if wave_file:
        wave_file.close()
    try:
        wave_file = open('sounds/' + name + '.wav', 'rb')
        wave = audiocore.WaveFile(wave_file)
        audio.play(wave, loop=loop)
    except OSError:
        pass # we'll just skip playing then
```

The `power_on()` function animates the NeoPixels and plays the sound effect when the sword powers up.

```python
def power_on(sound, duration):
    """
    Animate NeoPixels with accompanying sound effect for power on.
    :param sound: sound name (similar format to play_wav() above)
    :param duration: estimated duration of sound, in seconds (&gt;0.0)
    """
    prev = 0
    start_time = time.monotonic()  # Save audio start time
    play_wav(sound)
    while True:
        elapsed = time.monotonic() - start_time  # Time spent playing sound
        if elapsed &gt; duration:  # Past sound duration?
            break  # Stop animating
        animation_time = elapsed / duration  # Animation time, 0.0 to 1.0
        threshold = int(NUM_PIXELS * animation_time + 0.5)
        num = threshold - prev  # Number of pixels to light on this pass
        if num != 0:
            strip[prev:threshold] = [ALT_COLOR] * num
            strip.show()
            prev = threshold
```

The `mix()` function mixes the two NeoPixel colors together.

```python
def mix(color_1, color_2, weight_2):
    """
    Blend between two colors with a given ratio.
    :param color_1:  first color, as an (r,g,b) tuple
    :param color_2:  second color, as an (r,g,b) tuple
    :param weight_2: Blend weight (ratio) of second color, 0.0 to 1.0
    :return (r,g,b) tuple, blended color
    """
    if weight_2 &lt; 0.0:
        weight_2 = 0.0
    elif weight_2 &gt; 1.0:
        weight_2 = 1.0
    weight_1 = 1.0 - weight_2
    return (int(color_1[0] * weight_1 + color_2[0] * weight_2),
            int(color_1[1] * weight_1 + color_2[1] * weight_2),
            int(color_1[2] * weight_1 + color_2[2] * weight_2))
```

## The Loop

In the main loop, the `mode` number determines the functionality of the sword. The first time the code runs, `mode` is `0`. This triggers the sword to initiate the `power_on` function and then go into idle mode where `mode` is `1`.

```python
if mode == 0:  # If currently off...
        enable.value = True
        power_on('on', POWER_ON_SOUND_DURATION)  # Power up!
        play_wav('idle', loop=True)  # Play idle sound now
        mode = 1  # Idle mode

        # Setup for idle pulse
        idle_brightness = IDLE_PULSE_BRIGHTNESS_MIN
        idle_increment = 0.01
        strip.fill([int(c*idle_brightness) for c in COLOR])
        strip.show()
```

If `mode` is `1`, then the accelerometer is read. If the accelerometer's reading is greater than the movement thresholds then the sword will either perform the hit or swing modes with light and sound effects. Otherwise, the sword remains in idle mode and the NeoPixels pulse.

```python
elif mode &gt;= 1:  # If not OFF mode...
        x, y, z = accel.acceleration  # Read accelerometer
        accel_total = x * x + z * z
        # (Y axis isn't needed, due to the orientation that the Prop-Maker
        # Wing is mounted.  Also, square root isn't needed, since we're
        # comparing thresholds...use squared values instead.)
        if accel_total &gt; HIT_THRESHOLD:  # Large acceleration = HIT
            TRIGGER_TIME = time.monotonic()  # Save initial time of hit
            play_wav(random.choice(hit_sounds))  # Start playing 'hit' sound
            COLOR_ACTIVE = COLOR_HIT  # Set color to fade from
            mode = 3  # HIT mode
        elif mode == 1 and accel_total &gt; SWING_THRESHOLD:  # Mild = SWING
            TRIGGER_TIME = time.monotonic()  # Save initial time of swing
            play_wav(random.choice(swing_sounds))  # Randomly choose from available swing sounds
            # make a larson scanner animation_time
            strip_backup = strip[0:-1]
            for p in range(-1, len(strip)):
                for i in range (p-1, p+2): # shoot a 'ray' of 3 pixels
                    if 0 &lt;= i &lt; len(strip):
                        strip[i] = COLOR_SWING
                strip.show()
                time.sleep(SWING_BLAST_SPEED)
                if 0 &lt;= (p-1) &lt; len(strip):
                    strip[p-1] = strip_backup[p-1]  # restore previous color at the tail
                strip.show()
            while audio.playing:
                pass # wait till we're done
            mode = 2  # we'll go back to idle mode
            
        elif mode == 1:
            # Idle pulse
            idle_brightness += idle_increment  # Pulse up
            if idle_brightness &gt; IDLE_PULSE_BRIGHTNESS_MAX or \
               idle_brightness &lt; IDLE_PULSE_BRIGHTNESS_MIN:  # Then...
                idle_increment *= -1  # Pulse direction flip
            strip.fill([int(c*idle_brightness) for c in COLOR_IDLE])
            strip.show()
            time.sleep(IDLE_PULSE_SPEED)  # Idle pulse speed set above
        elif mode &gt; 1:  # If in SWING or HIT mode...
            if audio.playing:  # And sound currently playing...
                blend = time.monotonic() - TRIGGER_TIME  # Time since triggered
                if mode == 2:  # If SWING,
                    blend = abs(0.5 - blend) * 2.0  # ramp up, down
                strip.fill(mix(COLOR_ACTIVE, COLOR, blend))  # Fade from hit/swing to base color
                strip.show()
            else:  # No sound now, but still SWING or HIT modes
                play_wav('idle', loop=True)  # Resume idle sound
                mode = 1  # Return to idle mode
```

# Make a Zelda Master Sword with the RP2040 Prop-Maker Feather

## Assembly

## Assemble Blade and Hilt

Use M2.5x12mm long screws to attach the blades and hilt together.

![led_strips_screws-blade.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/364/medium640/led_strips_screws-blade.jpg?1691500257)

![led_strips_screws-hilt.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/365/medium640/led_strips_screws-hilt.jpg?1691500356)

## Solder NeoPixel Strip

Measure, cut and solder two NeoPixel strips about 73 pixels long, in parallel.&nbsp;

![led_strips_led-strip-parallel.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/361/medium640/led_strips_led-strip-parallel.jpg?1691499773)

![led_strips_Master-Sword-Circui-Diagram.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/391/medium640/led_strips_Master-Sword-Circui-Diagram.jpg?1691511558)

## Board and Speaker Holders

Use two M2.5x5mm screws to fasten the Prop-Maker RP2040 to the holder.&nbsp;

The speaker press fits face down into the holder.

Both holders use two additional M2.5x5mm screws to attach inside the handle.

![led_strips_board-holder.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/362/medium640/led_strips_board-holder.jpg?1691499941)

![led_strips_speaker-holder.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/363/medium640/led_strips_speaker-holder.jpg?1691499977)

## Battery and slide switch

Use two M2.5x5mm long screws to fasten the battery holder to the handle. &nbsp;The battery press fits with the wire positioned outside of the holder.

Solder a 2 Pin JST plug to the slide switch. Pass the JST plug through the cutout on the handle to press into place.

Solder a matching 2 Pin JST socket cable to the **EN** and **GND** pins on the Prop-Maker.

![led_strips_slide-switch-battery.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/366/medium640/led_strips_slide-switch-battery.jpg?1691500517)

![led_strips_slide-switch.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/367/medium640/led_strips_slide-switch.jpg?1691500664)

## Mount Prop-Maker

Align the holder to the screw mounts on the handle with the USB-C port point out.

Attach a JST extension to reach the battery. Place the wires under the board and use M25.x5mm screws to fasten the holder to the handle.

![led_strips_board-wire.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/368/medium640/led_strips_board-wire.jpg?1691500740)

## Speaker mount

Align the speaker and mount to the screw holes on the handle.&nbsp;

Use a Pico cable socket to extend the wire and connect to the + and - terminals on the Prop-Maker.

![led_strips_board-connections-close.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/369/medium640/led_strips_board-connections-close.jpg?1691500899)

## Place NeoPixel LED Strip

Center the two NeoPixel Strips back to back with the LEDs facing the blade edge.&nbsp;

![led_strips_led-strip-place.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/372/medium640/led_strips_led-strip-place.jpg?1691501379)

## Connect to Terminal

Connect the remaining wires to the terminals on Prop-Maker.

Place wires in the center so they don't block the sides of walls.&nbsp;

![led_strips_board-connections-medium.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/370/medium640/led_strips_board-connections-medium.jpg?1691501043)

## Attach halves

&nbsp;Use M3x20mm screws to attach both sides together.

![led_strips_screw-halves.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/371/medium640/led_strips_screw-halves.jpg?1691501279)

## Handle Detail

Paint the handle or you may use Paracord to add detail to the handle.&nbsp;

![led_strips_handle-paracord.jpg](https://cdn-learn.adafruit.com/assets/assets/000/123/373/medium640/led_strips_handle-paracord.jpg?1691501519)

## Complete!
![](https://cdn-learn.adafruit.com/assets/assets/000/123/388/medium800thumb/led_strips_master-sword-blast-loop.jpg?1691507766)


## Featured Products

### Adafruit RP2040 Prop-Maker Feather with I2S Audio Amplifier

[Adafruit RP2040 Prop-Maker Feather with I2S Audio Amplifier](https://www.adafruit.com/product/5768)
The Adafruit Feather series gives you lots of options for a small, portable, rechargeable microcontroller board. By picking a feather and stacking on a FeatherWing you can create advanced projects quickly. One popular combo is our [Feather M4](https://www.adafruit.com/product/3857)...

In Stock
[Buy Now](https://www.adafruit.com/product/5768)
[Related Guides to the Product](https://learn.adafruit.com/products/5768/guides)
### Adafruit Mini Skinny NeoPixel Digital RGB LED Strip - 144 LED/m

[Adafruit Mini Skinny NeoPixel Digital RGB LED Strip - 144 LED/m](https://www.adafruit.com/product/2969)
So thin. So mini. So teeeeeeny-tiny. It's the 'skinny' version of our classic NeoPixel strips!

These NeoPixel strips have 144 digitally-addressable pixel Mini LEDs per meter and are very affordable and are only 7.5 mm wide (0.3")&nbsp;if you remove the strip from the...

In Stock
[Buy Now](https://www.adafruit.com/product/2969)
[Related Guides to the Product](https://learn.adafruit.com/products/2969/guides)
### Lithium Ion Cylindrical Battery - 3.7v 2200mAh

[Lithium Ion Cylindrical Battery - 3.7v 2200mAh](https://www.adafruit.com/product/1781)
Need a big battery for your project? This lithium-ion battery contains a 2200mAh and a protection circuit that provides over-voltage, under-voltage, and over-current protection. Yet, it is slim and easy to fit into many project cases.  
  
This cell can provide 2 **C** of...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1781)
[Related Guides to the Product](https://learn.adafruit.com/products/1781/guides)
### JST-PH Battery Extension Cable - 500mm

[JST-PH Battery Extension Cable - 500mm](https://www.adafruit.com/product/1131)
By popular demand, we now have a handy extension cord for all of our JST PH-terminated battery packs (such as our LiIon/LiPoly and 3xAAA holders). One end has a JST-PH compatible socket, and the other end has a matching plug. Between the two, 500mm of color coded wire. Handy for wearable...

In Stock
[Buy Now](https://www.adafruit.com/product/1131)
[Related Guides to the Product](https://learn.adafruit.com/products/1131/guides)
### Mini Oval Speaker with Short Wires - 8 Ohm 1 Watt

[Mini Oval Speaker with Short Wires - 8 Ohm 1 Watt](https://www.adafruit.com/product/4227)
Hear the good news! This wee speaker&nbsp;is&nbsp;a&nbsp;great addition to any audio project where you need 8 ohm impedance and 1W or less of power. We particularly like this&nbsp;speaker&nbsp;as it is&nbsp;small and comes with nice skinny wires with a connector on the end. It has a handy...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4227)
[Related Guides to the Product](https://learn.adafruit.com/products/4227/guides)
### 1.25mm Pitch 2-pin Cable Matching Pair - 40cm long

[1.25mm Pitch 2-pin Cable Matching Pair - 40cm long](https://www.adafruit.com/product/4720)
When 0.1" is too big, and JST PH's too chunky, these ultra-slim 1.25mm connectors are a reliable alternative. These are only 1.25mm pitch, but have a nice clicky connection.

These cables are&nbsp;nice and long, 40cm in fact. They've&nbsp;got both small form factor and are a...

In Stock
[Buy Now](https://www.adafruit.com/product/4720)
[Related Guides to the Product](https://learn.adafruit.com/products/4720/guides)
### Breadboard-friendly SPDT Slide Switch

[Breadboard-friendly SPDT Slide Switch](https://www.adafruit.com/product/805)
These nice switches are perfect for use with breadboard and perfboard projects. They have 0.1" spacing and snap in nicely into a solderless breadboard. They're easy to switch no matter what size fingers you have, but not so easy that they'll get flipped by accident. Work great as...

In Stock
[Buy Now](https://www.adafruit.com/product/805)
[Related Guides to the Product](https://learn.adafruit.com/products/805/guides)
### JST PH 2-Pin Cable - Female Connector 100mm

[JST PH 2-Pin Cable - Female Connector 100mm](https://www.adafruit.com/product/261)
Red and black tinned wires with a 2-pin JST PH connector on the end. 4" / 100mm long. Matches up nicely with our Lipoly chargers!

[We have the socket 'mating' version of this cable](https://www.adafruit.com/product/3814) over here, <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/261)
[Related Guides to the Product](https://learn.adafruit.com/products/261/guides)

## Related Guides

- [Adafruit RP2040 Prop-Maker Feather](https://learn.adafruit.com/adafruit-rp2040-prop-maker-feather.md)
- [Mario Magic Wand](https://learn.adafruit.com/mario-magic-wand.md)
- [Guitar Synth with CircuitPython SynthIO](https://learn.adafruit.com/guitar-synth-with-circuitpython-synthio.md)
- [Haunted Air Blaster](https://learn.adafruit.com/automated-air-blaster.md)
- [Soundbox RP2040](https://learn.adafruit.com/soundbox-rp2040.md)
- [Motion Sensor Bat](https://learn.adafruit.com/motion-sensor-bat.md)
- [Lightsaber Prop-Maker RP2040](https://learn.adafruit.com/lightsaber-rp2040.md)
- [Ever-Burning Flame Painting](https://learn.adafruit.com/ever-burning-flame-painting.md)
- [Talking HAL 9000 with RP2040 Prop Maker Feather](https://learn.adafruit.com/hal-9000-rp2040-prop-maker.md)
- [Light-Up Reactive Ukulele](https://learn.adafruit.com/light-up-reactive-ukulele.md)
- [NeoPixel Run LED Arcade Game](https://learn.adafruit.com/pixel-chase-game.md)
- [Dune Worm Thumper](https://learn.adafruit.com/dune-worm-thumper.md)
- [Adabot Toy Robot Friend](https://learn.adafruit.com/adabot-rp2040.md)
- [PropMaker Jack O'Lantern](https://learn.adafruit.com/propmaker-jack-o-lantern.md)
- [Audio Synthesis with CircuitPython synthio](https://learn.adafruit.com/audio-synthesis-with-circuitpython-synthio.md)
