Once your hardware and software are working nicely, jazz up the box -- and even teach it new tricks! How far you take it is up to you.

Give your spooky box some personality with a few decorations! Be sure to attach everything to the box as securely as possible, as things will be bouncing around a lot.

Eyeballs look nice perched on top.

Pipe cleaners can be bent into arms and added to the sides. They jiggle when the lid moves for extra animation. You can staple the ends onto the box and cover with tape.

Finally, fill the box with light-weight, non-sticky creepy crawlies. The example here uses the ever-popular spider rings, with a few centipedes and roaches thrown in for variety.

If you're concerned about them interfering with the servo, add a wall made of scrap cardboard to keep the treats to one side.

Make it Do More with MakeCode

Doing the same thing all the time is boring! Mix it up a little by adding extra behaviors to your spooky box. The code shown here has three modes:

  • Mode #1 -- Laughing: The box laughs like in the previous code. The melody is made up of notes chosen to sound a little like cackling. It was created with a stack of play tone at [Middle C] for [1/2 beat] blocks from the MUSIC menu, which let you change the note played by choosing from a pop-up piano keyboard (or typing in the corresponding frequencies).
  • Mode #2 -- Dies Irae: The box doesn't open -- gotcha! -- but the lights flash in a premade pattern using the show animation [sparkle] for 500 ms block from the LIGHT menu while the speaker plays a well-known ominous theme called Dies Irae. It was created using a relatively new block in the MUSIC menu called play melody [] at tempo [120] bpm that lets you select eight notes from a colorful grid. Try it, it's fun!
  • Mode #3 -- Open-Close: The lid flies up and stays open for a few seconds (so visitors can grab a spider ring from its maw), then slowly closes. A premade light animation, premade musical phrase, and a stack of individual notes were added to make it easier to tell when the code was running on the screen.

Using some more advanced coding techniques like variables and functions, the three modes play in sequence. The first time the box is triggered, Mode #1 runs. The second time, it switches to Mode #2. And the third time, Mode #3 runs and the code resets to start over the next time with Mode #1.

Take a look at the code and try it out at the link below. Then play around with it to figure out how it works and make it your own.

Happy Halloween! Bwah-ha-ha-ha-hah...

This guide was first published on Oct 08, 2019. It was last updated on Mar 08, 2024.

This page (Trick Out Your Spooky Box) was last updated on Mar 08, 2024.

Text editor powered by tinymce.