Activity: Binary Bot

Complete the Driving Shapes exercise but using only binary numbers instead of decimal numbers. If you’re unfamiliar with Driving Shapes, all you need to do is program your rover to move in a shape e.g. square or triangle.

Activity Demonstration

Setup

Learning Binary

READ MORE

All you need is your computer, a Micromelon Rove and a flat, uniform surface to drive it on. If you’re unfamiliar with what binary is check out our Learning Binary post.

 

Here’s Our Approach

You can write a binary number by prefacing 0b before your binary number in python, e.g. 0b100 is 4.

The binary number block can be placed in any position a normal number block would go.

The convert block located in the utilities category has an option for binary. You can put a normal number block (from the MATH category) into this and convert it to any binary number, this is useful when you want to print out what a normal number would look like in binary.

Stage 1

For this solution we repeated the while loop forever so we keep getting a square movement pattern. Then I substituted my binary blocks into the turn degrees and movement blocks.

To Note

Sometimes you’ll need to adjust your angles since the rovers will turn different amounts depending on the surface they are on. See if you can find a really accurate solution with your rover and on the floor in the classroom.

Example Code

Example Code

 

Related Posts

Previous
Previous

Learning Binary

Next
Next

Activity: Rover Van Gogh