|CSC 161||Grinnell College||Fall, 2011|
|Imperative Problem Solving and Data Structures|
The goal of this lab is to practice using the Scribbler 2 motion commands, while increasing proficiency with loops and conditionals.
Before beginning the following exercises, move to the labs folder used for
this class and create a file called
this lab. Also, remember to set the forwardness in every program with
motion using the command
Often, you will want to write programs that have the Scribbler 2
move for varying amounts of time. In
write commands that perform the following actions.
Spirals begin from a center point, with the line moving in a circular motion, with a gradually greater distance from the origin. There are two straightforward ways, each using only one loop, that moves the Scribbler 2 in a spiral motion for at least ten seconds.
rMove(double translate, double
The Scribbler 2 robot has many capabilities; so far, you have been introduced to motion and sound. In this exercise, you will try to get the robot to move while beeping. Pseudocode is provided for each exercise.
connect to the robot move forward for one second beep for one second disconnect from the robot
connect to the robot beep for one second move forward for one second disconnect from the robot
connect to the robot move forward stop beep for one second disconnect from the robot
Hint: use a continuous command such as
connect to the robot move forward beep for one second stop disconnect from the robot
You now know how to make the robot beep while moving. You also learned in a previous lab how to use a loop to make rising pitches. Now, you will combine the two actions. Write a program that moves the Scribbler 2 while it beeps fifteen times in a row, with every beep rising in pitch, then stops the Scribbler 2.
When you have finished this lab, be sure to fill out its evaluation form in the "Lab Evaluation" section for CSC 161 on Pioneer Web
This document is available on the World Wide Web as
created 21 July 2011 by April O'Neill
last full revision 29 July 2011 by April O'Neill
minor editing 24 August 2011 by Henry M. Walker
|For more information, please contact Henry M. Walker at email@example.com.|