How does a robot detect things in its environment without physical contact?
How can you make Phiro react to objects or even another 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.
By the end of this lesson, learners will
How does a robot detect things in its environment without physical contact?
How can you make Phiro react to objects or even another Phiro?!
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.
(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.
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)
Remix your code by adding Led's option. All remix with your own innovation.
Share your Phiro obstacle detection and avoidance system using #MyPhiro and we will share it with the world.