When we put together one or more commands to control the Linkbot robot, we are creating a "program." In other words, a computer program is like a recipe, a series of instructions to get something done. Often when we create a program we make mistakes, such as using the wrong command, or the right command at the wrong time, or the wrong numbers in the right command, or so on and so forth. These errors are called "bugs," and so we often need to "debug" the program in order to fix it and get it working properly. The Step button (just to the right of the Run button) is helpful in debugging, because it will step through a program's commands one at a time. At each step the command being executed is displayed in orange in the Workspace. This lesson gives you some practice in debugging, and also introduces the turn code block, which instructs the robot to turn left or right at a certain angle (90 degrees for a right angle turn):
|
Grid Size: S M L | Simple View: | MinView: |
|
Coord: x-axis y-axis | Grid Lines: x-axis y-axis | |||
Grid: | 12x12 inches | 24x24 inches | 36x36 inches | |
72x72 inches | 96x96 inches | 192x192 inches | ||
1x1 inches | 2x2 inches | Fraction: | ||
xy-Range: | ||||
|
||||
|
||||
Quad: | 1 Quadrant | 4 Quadrants | 1&4 Quadrants | |
Units: | US Customary | Metric | Ruler: |
Labels: |
|
|
|
Font
px
|
|
Tics Lines: |
|
Width
px
|
Hash Lines: |
|
Width
px
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
|
The Linkbot wants to move in the positive y direction for 10 units, then turn 90 degrees right and move in the positive x direction for 7 units. Finally, it wants to turn 90 degrees right again and move in the negative y direction 18 units, so that it ends up at the position x = 7, y = -8. Change the argument values in the pre-placed code blocks to enable the Linkbot to make this journey. Use the Step button to step through the commands one at a time. If you get it right the first time, try entering incorrect argument values and see what happens. |
|
|
|||||||||||
|
|||||||||||