---
title: "Activity: Binary Bot"
date: "2022-05-10"
categories: ["Activities", "All", "Simulator Activities"]
tags: ["Iteration", "Motors", "Maths", "Intermediate"]
excerpt: "Complete a simple exercise using only binary numbers!"
featuredImage: "/images/resources/binary-bot.png"
---

** **

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.

![](/images/content/2e96eb-drivingshapes.png)

Activity Demonstration

### Setup

![](/images/content/2eaef8-unsplash-image-kgltfcgfc28.jpg)

#### Learning Binary

[**READ MORE**](/resources/learning-binary)

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.

![](/images/content/7d9018-binary-bot-answer-1.png)

Example Code

![](/images/content/07757e-binary-bot-answer-2.png)

Example Code
