Pi Supply bit:buggy Project 05 – Crazy Dance

In the last project we showed you how to control the LEDs on the bit:buggy, now we are going to create some awe inspiring dance moves into the mix with some crazy snazzy dance moves.

Connect your hardware

If you haven’t done so already, connect the left servo wheel to P1 and the right servo wheel to P2.

Coding

Step 1 – Snap in place the block “go straight at full speed” into the “On start” block. The port number is the actual servo connection port.

Step 2 – Snap into place a “forever” block so we can loop our blocks of code continuously, add a variable block for “left” and “right”. In the variable we want to create a random number between -100 and 100. This will make the bit:buggy move in a random motion.

Step 3 – Under the variables we just created go ahead and ad the block “set left wheel speed left set right wheel speed right”. Pause the code for 1000ms.

Step 4 – Upload your sketch to the bit:buggy

Here is the program link – https://makecode.microbit.org/_C6scgyF3xLWm

 Action

Once you have powered on the bit:buggy it should dance and move in random directions.

Taking it further

How can you make the bit:buggy move at a slower speed?

Project Examples

First published at 4:12pm on October 29, 2019
Last updated at 1:04pm on December 12, 2019