Learn to program

 
  Finch assignments ::

Learning Goal: Understand how to write a program to control a robot, using loops, conditionals and subroutines where appropriate.

 

 
 

Finch Assignment 9 - Travel


You are going to add more functions to your module.


Attach a pen to the Finch's tail. Program the Finchto go forward for 1 or more seconds.


Measure the length of the line it draws. Use this to calculate cm/s.


Write a function travel(distance) to make the robot travel the given distance. Use cm as your units.

In other words, when you call the function travel, you add the distance you want the Finch to travel
inside the parentheses.

That number will be stored in the variable distance, and the Finch must be programmed to do the calculation to convert the
input distance into the correct time for it to travel at that speed. You know how far the Finch travels in one second -
calculate how many seconds it should travel to go the distance required.

Test the function on the robot a few times to see how accurate the line is.

Turn the program in to EETT2 - Pereira - AI 201x - Python assignments as travelyourname then add it to your library module.

For extra credit, use speed as well as distance as variables.

 

 

Write a Reflection on what you have learned.