6. case 04 Show Box for Stickers

6.1. Goal


  • Make a show box for stickers you like.

6.2. Materials


  • 1 x Servo

  • 1 x Cardboard

  • 1 x Hot melt glue gun

  • 1 x Scissors

  • 1 x Handmade knife

  • 1 x Crash sensor

  • 1 x Batteries pack

  • 1 x basic kit board

6.3. Background


What is a show box for your stickers?

  • Do you want to show your lovely stickers to others ? Let’s make a show box for stickers.

How does it work?

  • When micro:bit is received signal detected by crash sensor by basic:kit board, the servo turns and the door of show box opens.

6.4. Practical operation


Prepare a handmade knife, a hot melt glue gun, a scissors and a piece of cardboard.

../../_images/PuJE7uj.jpg

../../_images/OsrstYv.jpg

../../_images/t6A0IwP.jpg

Set up as below:

Front side:

../../_images/lNqGReU.jpg

Back side:

../../_images/CFhFVSw.jpg

Set and stick components as below.

../../_images/Ht61Ezt.jpg

Prepare your lovely stickers and stcik them as below.

../../_images/x9URpgH.jpg

../../_images/qWBA3jV.jpg

Thread wires through the hole of front side.

../../_images/8qVyDfP.jpg

6.5. Hardware connect


  • Connect servo to P1, crash sensor to P2 and battaries pack to micro:bit. (as below)

../../_images/ENM9JdP.jpg

6.6. Software


makecode

6.7. Programming


Step 1

Under “on start”,set pull pin P2 to up to keep signal stable. Set servo write pin P1 to 180, then the sticker board is at rest.

Set door as a variable, and its initial value is false for saving status of sticker board.

../../_images/OR3keAM.png

Step 2

Under forever, snap if statement to judge if the P2 port is equal to 0, it means if the sensor switch is pressed.

When the value P2 port is equal to 2, the sensor switch is pressed, set variable door to not door.

Then, snap another if statement to control the value of varible door, which means to judge the status of the door. If variable door is equal to true, then the sticker board will move(P1=0).

../../_images/LSq6eMr.png

Step 3

When the value of P2 is not equal to 0, the sensor switch is not be pressed.

Then, the sticker board is at rest(set P1 to 180).

../../_images/DDbGunP.png

Program

Please refer to detail programming:https://makecode.microbit.org/_0JmTbLKuXA8s

You also could directly download program visit website as below:

---

6.8. Result


Press the crash module, your stickers begins to moving.

../../_images/ZqjLRFB.gif

6.9. Think


How to show more stickers to your friends?

6.10. Questions


6.11. More Information