7. Case 04: Run at Random#

7.1. Purpose#


  • Make your Cutebot move(move forward, reverse or change direction) as if in “his” mind.

7.2. Materials#


7.3. Software Platform#


MicroSoft makecode

7.4. Programming#


Step 1#

  • Click the “Advanced” to see more choices in the MakeCode drawer.

../../_images/cutebot-pk-13.png

  • A codebase is required for Cutebot programming, click “Add Package” at the bottom of the drawer, search [Cutebot](https://www.elecfreaks.com/micro-bit-smart-cutebot.html) in the dialogue box and download it.

../../_images/cutebot-pk-111.png

Note: If you met a tip indicating incompatibility of the codebase, you can continue with the tips or build a new project there.

Step 2#

  • Choose “show icon” in the On startbricks.

../../_images/case_01_022.png

Step 3#

  • Drag left_speed and right_speed bricks into forever brick to set a speed at random from -100 to 100 of the two wheels.

  • Assign the two variables of the speed to the left and right wheels.

../../_images/case_04_013.png

Programming#

Links: https://makecode.microbit.org/_ECTDYXJJiRLk

You can also download it directly below:

7.5. Result#


The Cutebot moves forward, reverses or changes its direction at random.

7.6. Exploration#


7.7. FAQ#


7.8. Relevant Files#