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 8 - Travel


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.

To turn it in, look at the instructions below or or watch this video:

  • Go to Google Drive
  • Open the Class Assignments AI folder in 'Shared with me'
  • Open your class folder and assignment folder
  • Click on the "New" button on the top left
  • Upload the program from your computer

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

 

 

Write a Reflection on what you have learned.