Scaredy Cat Phiro

Create a program for Phiro to move Forward or Backward based on distance sensor values. Make Phiro moves faster when obstacle is near and slower or stop when there is no obstacle, using Pocket Code.

Objective

By the end of this lesson, learners will

  • Identify and understand Phiro's sensors
  • Understand and use sensor and arithmetic function to control Phiro
  • Create a program to control sensors
  • Connect the physical and digital worlds
  • Practice experimenting & iteratin.
  • Express their creativity by programming a Phiro robot to interact with objects or other Phiro robot using Sensors.
Subjects

Robotics, Coding, Sensors, Maths

Age

9 & above

Duration

30 min

Robot & Accessories Needed

Phiro Pro robot

  • step1
  • step2
  • step3
  • step4
  • step5
  • step6
STEP 1

Ask

How does a robot detect things in its environment without physical contact?

How can you make Phiro react to objects or even another Phiro?!

STEP 2

Imagine

Imagine what would you need to solve this challenge?

How can we use sensor value to control Phiro?

How do we Convert Sensor value range into motor value range.

STEP 3

Plan

(Optional: Transform Phiro into a Cat with LEGO blocks or artwork mounted on the robot)

Explore Phiro's 6 sensors. Figure out which sensors on Phiro will suits best for our challenge.

What is the minimum and maximum value of Sensor?

What is the value of sensor, when object is near?

Plan your coding for

1. Reading Sensor Value.

2. Figuring out maximum and minimum value of sensors in the environment.

3. Select movement for Phiro.

4. Set Phiro Speed Range to Sensor Value.

5. Compute Sensor value range to Phiro Speed Range.

Test the Program.

STEP 4

Create

Reading Sensor value


Moving Phiro Forward via Sensor values: Range of Sensor 0 – 800 in this environment is converted into Phiro Speed value 0 - 100


Modify this program and make Phiro move backward with respect to sensor value, when object comes closer Phiro moves backward.

Moving Phiro Backward via Sensor values

Make Phiro move backward when Phiro sensor senses object and control Phiro speed with respect to closeness of object

(Note: Phiro moves faster, when object is near and slower when object is far)

STEP 5

Remix

Remix your code by adding Led's option. All remix with your own innovation.

STEP 6

Share

Share your Phiro obstacle detection and avoidance system using #MyPhiro and we will share it with the world.