Valentine's Unicorn Box
2018-02-14 | By Kevin Walseth
Using the Micro:bit for Valentines box eyes:
My 8-year-old daughter was tasked by her 3rd grade teacher to build a Valentines box for their party this year. I told her to search the web and find something she liked. Not surprised, she picked a unicorn. Then she said “Dad, can we use the eyes out of the skull you made at work”? See project here. Originally I agreed and told her it was a great idea. After thinking about it, I wanted her to make this project not me! So I thought about the Micro:Bit.
The Micro:Bit was created by the BBC in England to teach kids to code and become more involved in electronics. It is a tiny programmable computer with a matrix of 25 leds, Bluetooth, 2 buttons, and much more. It was designed to make learning coding fun and easy. No software needed – simply use makecode.microbit.org
I sat her down weeks before Valentine’s day and showed her some of the operation of Makecode. With zero coding experience, the block style programming was very easy for her to catch on. I walked away and about an hour later she wanted to show me what she did. My mind was blown! She had created the eyes, paused and even had it blink to a heart. She then wanted it to say her name so I said it was possible, try to figure it out without me. She sure did! The Micro:bit was then scrolling her name “Lexie” followed by eyes to the right, eyes to the left, a blink, and a heart.
Now how do I get it on the other eye. Now this is where my help came in. I thought for a little while on how we could get this to work simultaneously. The Micro:bit has built-in Bluetooth. I hadn’t tried it before so it was new to me as well. It was so easy! Here is how I did it:
I plugged both Micro:bits into the computer and remembered which one was RX (receive) and which was TX (transmit). To start programming, I opened two windows of makecode.microbit.org and saved the files unicorn RX and unicorn TX. The first command is to set the radio group to be the same on both.
Here is the rest of the code:
The pauses before and after the “show string” are to time the text to look as if it is scrolling across the eyes and to make sure the eyes blink at the same time.
The Micro:Bit is an amazing STEM project and is so good for getting kids involved in coding. My daughter was so excited that she was able to do this. The look on her face when she said she could tell her friends that she coded it was priceless.
For the power, I just used a JST 3AAA battery pack and spliced in a second connector to it and the project was a huge success.
Kevin Walseth
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum