---
title: "Activity: Survey Bot"
date: "2021-06-03"
categories: ["Activities", "All"]
tags: ["Iteration", "IR", "Motors", "Maths", "Advanced", "Colour Sensors"]
excerpt: "Learn iteration while using the IR sensors."
featuredImage: "/images/resources/survey-bot.png"
---

**  |  **

Program the rover to perform a distance survey of the area around it. Have the rover turn on the spot and print out the value of one of the IR distance sensors at intervals around the circle.

####
  Relevant Coding Skills

    Branching

	--&gt;

    Iteration

    Functions

    Variables

	--&gt;

    Algorithm Design

  --&gt;

    Maths

####
   Relevant Rover Concepts

    Ultrasonic

 --&gt;

    IR

    Colour

    Gyroscope

    Accelerometer

    Motors

    LEDs

	--&gt;

    Buzzer

 	--&gt;

Activity Demonstration

### Setup

The IR distance sensors have a maximum range of approximately 125cm. If nothing is detected an IR sensor it will read 255.0cm. Place the rover amongst a collection of objects, run the code, and see if a partner can say where the objects were by only reading the distances the robot prints out. This can be done faster by using both IR sensors and only turning 180 degrees.

### Here’s Our Approach

#### **Stage 1**

In our approach, our objective is to get 15 readings from the environment around us. You might use a different number of readings. We will start with a loop block that repeats 15 times. If you’re missing obstacles, try a higher number to collect more readings.

**Stage 2**

We will need a motor turn by degrees block inside our loop. If we want our robot to have turned a full 360 degree circle once the code has finished running, this block will need to turn one fifteenth of a circle each iteration. After it has run 15 times our rover will have turned a full 360 degrees. We can use a math operation block to divide 360 by 15.

#### **Stage 3**

Finally we need the rover to print out the IR distance values. The print block will print that IR value to the console.

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1622686313464-N1SCSLXE642VO88LQ5FH/surveybot-answer.png)

Example Code

### Related Posts

          Resources

      [

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1639455538805-9NI7CPKR7IYG6D4RBKAN/high+quality+sumo.png)

  ](/resources/creating-a-sumo-unit)

	[All](/resources?category=All)

                [Creating A Sumo Unit For Your Digital Technologies Class](/resources/creating-a-sumo-unit)

	[All](/resources?category=All)

How to run a sumo unit in your digital technologies classroom.

                [Read More &#8594;](/resources/creating-a-sumo-unit)

	[All](/resources?category=All)

      [

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1637464845856-BBPD7GTIIHHOSJCFORWF/the+ultrasonic+sensor.png)

  ](/resources/ultrasonic-sensor)

	[All](/resources?category=All), [Guides](/resources?category=Guides)

                [The Ultrasonic Sensor](/resources/ultrasonic-sensor)

	[All](/resources?category=All), [Guides](/resources?category=Guides)

Learn all about the ultrasonic sensor!

                [Read More &#8594;](/resources/ultrasonic-sensor)

	[All](/resources?category=All), [Guides](/resources?category=Guides)

      [

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1625616494179-LZHZP5MUA0E0MQKEB7HC/cropped+image+4.png)

  ](/resources/year-7-digital-tech-at-st-peters)

	[All](/resources?category=All), [Customer Stories](/resources?category=Customer+Stories)

                [Case Study: Year 7 Digital Tech at St Peters Lutheran College](/resources/year-7-digital-tech-at-st-peters)

	[All](/resources?category=All), [Customer Stories](/resources?category=Customer+Stories)

See how Meg Foley at St Peters conducted a challenge for their Year 7s using Micromelon.

                [Read More &#8594;](/resources/year-7-digital-tech-at-st-peters)

	[All](/resources?category=All), [Customer Stories](/resources?category=Customer+Stories)
