# Unicorn Christmas Stocking with Rainbow Lights & Sound

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/085/597/medium800/projects_unicorn_stocking.jpeg?1575928294)

Give the gift of curiosity this year with a Circuit Playground Express. The young imagineer in your home will be delighted to wake up on Christmas morning and find a brand new Christmas stocking that sings her favorite Christmas songs and lights up in her favorite colors.&nbsp;

This is a great project to do with kids, or to make on your own to surprise them Christmas morning. There is no sewing or soldering required, and the code is easy to create and customize using the MakeCode drag-and-drop code editor.

Add some batteries, and watch their eyes light up when they see what Santa brought.

## Parts
### Circuit Playground Express

[Circuit Playground Express](https://www.adafruit.com/product/3333)
 **Circuit Playground Express** is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and made it even better! Not only did we pack even more sensors in, we also made it even easier to...

In Stock
[Buy Now](https://www.adafruit.com/product/3333)
[Related Guides to the Product](https://learn.adafruit.com/products/3333/guides)
![A Black woman's manicured hand holds a round microcontroller with lit up LEDs.](https://cdn-shop.adafruit.com/640x480/3333-05.jpg)

### 3 x AAA Battery Holder with On/Off Switch and 2-Pin JST

[3 x AAA Battery Holder with On/Off Switch and 2-Pin JST](https://www.adafruit.com/product/727)
This battery holder connects 3 AAA batteries together in series for powering all kinds of projects. We spec'd these out because the box is slim, and 3 AAA's add up to about 3.3-4.5V, a very similar range to Lithium Ion/polymer (Li-Ion) batteries and have an on-off switch. That makes...

In Stock
[Buy Now](https://www.adafruit.com/product/727)
[Related Guides to the Product](https://learn.adafruit.com/products/727/guides)
![Front angled shot of 3 x AAA battery holder with on-off switch and 2-pin JST PH connector.](https://cdn-shop.adafruit.com/640x480/727-07.jpg)

### Alkaline AAA batteries - 3 pack

[Alkaline AAA batteries - 3 pack](https://www.adafruit.com/product/3520)
Battery power for your portable project! These batteries are good quality at a good price, and work fantastic with any of the kits or projects in the shop that use AAA's. This is a pack of **3 AAA batteries**.  
  
These batteries are Alkaline (MnO2) chemistry, with a...

In Stock
[Buy Now](https://www.adafruit.com/product/3520)
[Related Guides to the Product](https://learn.adafruit.com/products/3520/guides)
![Angled shot of 3 PKcell AAA batteries. ](https://cdn-shop.adafruit.com/640x480/3520-00.jpg)

### Fully Reversible Pink/Purple USB A to micro B Cable - 1m long

[Fully Reversible Pink/Purple USB A to micro B Cable - 1m long](https://www.adafruit.com/product/4111)
This cable is not only super-fashionable, with a woven pink and purple Blinka-like pattern, it's also fully reversible! That's right, you will save _seconds_ a day by not having to flip the cable around.

First let's talk about the cover and over-molding. We got these...

In Stock
[Buy Now](https://www.adafruit.com/product/4111)
[Related Guides to the Product](https://learn.adafruit.com/products/4111/guides)
![Fully Reversible Pink/Purple USB A to micro B Cable](https://cdn-shop.adafruit.com/640x480/4111-02.jpg)

### Additional Materials Needed

- A Christmas stocking
- Craft Foam in white, black and sparkly&nbsp;
- Ziploc sandwich bag
- Sticky-back velcro square
- Scissors&nbsp;
- Hot glue gun
- Glitter glue, ribbons, jewels, and embellishments

# Unicorn Christmas Stocking with Rainbow Lights & Sound

## Program with MakeCode

The Circuit Playground Express can be programmed a number of ways: it will run Arduino code, CircuitPython, or you can program it with MakeCode.&nbsp;&nbsp;

 **Microsoft MakeCode for Adafruit&nbsp;** is a web-based code editor&nbsp;for physical computing. It provides a block editor, similar to Scratch or Code.org, and also a JavaScript editor for more advanced users.&nbsp;

This means you can drag and drop light animations and functionality using the Circuit Playground Express' onboard sensors without ever writing a single line of code. Just snap the blocks together and watch your lights dance.

[Check out our MakeCode intro guide here.](https://learn.adafruit.com/makecode/what-is-makecode)
For this project, I used the Circuit Playground's onboard lights to run a pretty rainbow color animation and the onboard speaker to play Jingle Bells every time a button is pressed. The colors and sounds are easy to customize to play your favorite Holiday song.

Go to&nbsp;[https://makecode.adafruit.com/](https://makecode.adafruit.com/)and select "New Project".

Give it a name. I called mine "Unicorn Stocking."&nbsp;

First we'll add the light animation. Click the **LIGHT** tab and drag an instance of `show animation for 500 ms` into your workspace, and drop it inside the `forever` loop that's already on the desktop. (If it's not there, you can find it under the **LOOPS** tab).&nbsp;

Anything placed inside this block will run over and over, forever.

![projects_mc_00_animation.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/598/medium640/projects_mc_00_animation.jpg?1575928723)

Check out the simulator on the left side of the screen. Are the lights animating rainbow? That means you've done it right. This is easy.

Now we'll add music that plays when the button on the face of the Circuit Playground is pressed. The buttons or sensors are accessed under the **INPUT** tab.

Drag an instance of `on button A click` from the **INPUT** tab into the workspace. Anything inside this block will run whenever the **A** button (or whatever input you choose) is clicked.

While you're here, take a look under the dropdowns to see all the different input options you've got. I kept it simple using button **A** , but you can trigger your code with any of these inputs just by selecting them.

![projects_mc_01_input.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/599/medium640/projects_mc_01_input.jpg?1575928845)

Choose the **MUSIC** tab and drag an instance of `play melody at tempo` into your `on button A` loop.&nbsp;

![projects_mc_03_melody.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/600/medium640/projects_mc_03_melody.jpg?1575929076)

Click the music note and the editor window will appear. Choose your first melody note from the first column, the second from the second column, etc. For a rest note, leave the column blank.

Jingle Bells starts on the third of its key, so it will work out best if you voice it as shown. Each `play melody` block will play up to 8 notes, but you can copy and paste the block inside the `on button A loop` until you have as many lines as you'd like.

![projects_mc_04_melody1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/601/medium640/projects_mc_04_melody1.jpg?1575929138)

![projects_mc_05_melody2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/085/602/medium640/projects_mc_05_melody2.jpg?1575929158)

![](https://cdn-learn.adafruit.com/assets/assets/000/085/603/medium800/projects_mc_06_bpm.jpg?1575929423)

Click the **A** button in the simulator to hear your melody played back. I found 120 bpm to be a bit slow and dirge-like, so I sped up my tempo to 200 bpm, which is a bit more cheerful.

There are more tools available under the **MUSIC** tab that will allow you more control -- play around with them until you're happy with your composition.&nbsp;

## Download the Code

1. Plug your Circuit Playground Express into your computer with a USB cable.&nbsp;
2. Click the reset button.&nbsp;
3. Green lights will appear on the Circuit Playground's face&nbsp; and it will appear in your list of devices, called **CPLAYBOOT**.&nbsp;

_If you don't see this or get a drive called CIRCUITPY, try double-clicking the reset button instead of single-clicking to get to a drive named CPLAYBOOT. Putting code on a CIRCUITPY drive will not program it._

Click the pink **Download** button on your MakeCode screen and the code you just made will download to your computer.&nbsp; Drag it onto the **CPLAYBOOT** device.&nbsp;&nbsp;

If all goes well, you will see a pretty rainbow animation.&nbsp; Click the **A** button and the Circuit Playground's tiny onboard speaker will play Jingle Bells. Hooray!

Here's the completed project that you can play with directly.

https://makecode.com/_7us1H570dJeT

# Unicorn Christmas Stocking with Rainbow Lights & Sound

## Make the Unicorn

Stick the Circuit Playground to the front of the battery case (the side with the on/off switch) using sticky back velcro. This way it's easy to remove and use again later on in a different project.

![projects_00_velcro.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/085/604/medium640/projects_00_velcro.jpeg?1575929888)

We'll use a ziploc bag to make a clear pocket for the Circuit Playground and battery case. I didn't have one of the right size, so I cut one down and glued the left side closed with hot glue. Leave the top open. You want it to fit fairly snugly so it doesn't wiggle around too much.

![projects_07_ziploc.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/085/608/medium640/projects_07_ziploc.jpeg?1575929996)

Use a couple safety pins to pin your ziploc pocket to the front of the stocking. Make sure not to pin all the way through both sides of the stocking or you won't be able to fit the presents inside.

![projects_09_safetypins.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/085/609/medium640/projects_09_safetypins.jpeg?1575930073)

## Layout

I want the Circuit Playground Express to land right behind the unicorn's eye. It's a good idea to cut your shapes out of paper first to make sure you've got your sizes right and that you're happy with placement. Here is the basic shape of the unicorn's head, with a large eye centered right on the middle of the stocking.

![](https://cdn-learn.adafruit.com/assets/assets/000/085/607/medium800/projects_05_laid_out.jpeg?1575929984)

Cut the head shape from white craft foam and the horn shape from sparkly craft foam in the color of your choice. Cut a small pupil and some fluttery eyelashes from black craft foam.

Feel free to download and trace my head shape -- the grid in the photo is 1" squares, for size reference. Or draw your own unicorn shape! Your inner unicorn is beautiful and perfect.

It may also be fun to use your child's drawing as a template - she'll be delighted to see her very own imaginary unicorn come to life.

![projects_03_headshape.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/085/616/medium640/projects_03_headshape.jpeg?1575930515)

![projects_02_horn.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/085/617/medium640/projects_02_horn.jpeg?1575930522)

![projects_04_eyes.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/085/618/medium640/projects_04_eyes.jpeg?1575930543)

Use low temperature hot glue to glue the head shape to the ziploc bag pocket, lining up the lights right where you want the eye to be. Glue the horn and eye pieces on in the same manner. I also glued the tip of the horn down to the stocking itself.

![projects_10_gluehead.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/085/619/medium640/projects_10_gluehead.jpeg?1575930622)

![projects_11_glueeyes.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/085/620/medium640/projects_11_glueeyes.jpeg?1575930715)

For the mane, I am using tubular crin ribbon since it's just so very very sparkly. You can find this at most craft stores. Yarn or ribbons or doll hair would work well here too. I added a zip tie around the strands and looped that over the unicorn's ear, adding judicious dabs of hot glue to hold it in place. If the mane is getting in the unicorn's eyes, you can braid in some ribbons to keep it managed.

![projects_12_hair.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/085/621/medium640/projects_12_hair.jpeg?1575930733)

![projects_13_hair_on.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/085/622/medium640/projects_13_hair_on.jpeg?1575930749)

![](https://cdn-learn.adafruit.com/assets/assets/000/085/623/medium800/projects_unicorn_stocking.jpeg?1575930846)

## Decorate

Add jewels, glitter glue, or other embellishments to make your unicorn unique and special. Draw on a smile, hang your stocking by the fireplace and fill to overflowing with fun gifts for your young maker.


## Featured Products

### Circuit Playground Express

[Circuit Playground Express](https://www.adafruit.com/product/3333)
 **Circuit Playground Express** is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and made it even better! Not only did we pack even more sensors in, we also made it even easier to...

In Stock
[Buy Now](https://www.adafruit.com/product/3333)
[Related Guides to the Product](https://learn.adafruit.com/products/3333/guides)
### 3 x AAA Battery Holder with On/Off Switch and 2-Pin JST

[3 x AAA Battery Holder with On/Off Switch and 2-Pin JST](https://www.adafruit.com/product/727)
This battery holder connects 3 AAA batteries together in series for powering all kinds of projects. We spec'd these out because the box is slim, and 3 AAA's add up to about 3.3-4.5V, a very similar range to Lithium Ion/polymer (Li-Ion) batteries and have an on-off switch. That makes...

In Stock
[Buy Now](https://www.adafruit.com/product/727)
[Related Guides to the Product](https://learn.adafruit.com/products/727/guides)
### Alkaline AAA batteries - 3 pack

[Alkaline AAA batteries - 3 pack](https://www.adafruit.com/product/3520)
Battery power for your portable project! These batteries are good quality at a good price, and work fantastic with any of the kits or projects in the shop that use AAA's. This is a pack of **3 AAA batteries**.  
  
These batteries are Alkaline (MnO2) chemistry, with a...

In Stock
[Buy Now](https://www.adafruit.com/product/3520)
[Related Guides to the Product](https://learn.adafruit.com/products/3520/guides)
### Fully Reversible Pink/Purple USB A to micro B Cable - 1m long

[Fully Reversible Pink/Purple USB A to micro B Cable - 1m long](https://www.adafruit.com/product/4111)
This cable is not only super-fashionable, with a woven pink and purple Blinka-like pattern, it's also fully reversible! That's right, you will save _seconds_ a day by not having to flip the cable around.

First let's talk about the cover and over-molding. We got these...

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

## Related Guides

- [Adafruit Circuit Playground Express](https://learn.adafruit.com/adafruit-circuit-playground-express.md)
- [Make It Glow: How to Solder NeoPixels, A Beginner's Guide](https://learn.adafruit.com/make-it-glow-how-to-solder-neopixels-a-beginners-guide.md)
- [Circuit Playground Express: Piano de Limones](https://learn.adafruit.com/circuit-playground-express-piano-de-limones.md)
- [Light Up Paper Dragon Wall Sconce](https://learn.adafruit.com/light-up-paper-dragon-wall-sconce.md)
- [CircuitPython 101: Basic Builtin Data Structures](https://learn.adafruit.com/basic-datastructures-in-circuitpython.md)
- [Paper-Craft Crystal Gem Lantern](https://learn.adafruit.com/paper-craft-crystal-gem-lantern.md)
- [Circuit Playground Express Automatic Sunglasses](https://learn.adafruit.com/circuit-playground-express-auto-sunglasses.md)
- [Mouse Painter: Emulate Mice with MakeCode ](https://learn.adafruit.com/mouse-painter-emulate-mice-with-makecode.md)
- [Make It Hot or Cold](https://learn.adafruit.com/make-it-hot-or-cold.md)
- [Cartoon Network MakeCode: Garnet's Palm Gems from Steven Universe](https://learn.adafruit.com/cartoon-network-makecode-garnet-s-palm-gems-from-steven-universe.md)
- [Jack-o-Theremin](https://learn.adafruit.com/jack-o-theremin.md)
- [Stroboscopic Zoetrope](https://learn.adafruit.com/strobe-zoetrope.md)
- [Easy Sparkle Pocket T-Shirt](https://learn.adafruit.com/easy-sparkle-pocket-t-shirt.md)
- [How Tall Is It?](https://learn.adafruit.com/how-tall-is-it.md)
- [How to Program SAMD Bootloaders](https://learn.adafruit.com/how-to-program-samd-bootloaders.md)
- [Circuit Playground D6 Dice](https://learn.adafruit.com/circuit-playground-d6-dice.md)
