Barobo
PortalSign In
HomeShopTutorialsFree CurriculumHour of Code
RoboBlockly for Learning Math and Coding

CSP Unit 3 Lesson 8.5

Piano
Linkbot Image Mindstorm Image
0x36302418126y36302418126
Grid:
Tics Lines:
Width px
Hash Lines:
Width px
Labels:
Font px
Trace Lines:
Robot 1:
Width px
Robot 2:
Width px
Robot 3:
Width px
Robot 4:
Width px
Labels: x-axis y-axis Show Grid
Grid: 12x12 inches 24x24 inches 36x36 inches
72x72 inches 96x96 inches 192x192 inches
Quad: 4 Quadrants 1 Quadrant 1&4 Quadrants
Units: US Customary Metric
Background: Background Image

Robot 1

0
S
M
L
Initial Position:
( in, in)
Initial Angle:
deg
Current Position: (0 in, 0 in)
Current Angle: 90 deg
Wheel Radius:
Track Width:
in

Robot 2

0
S
M
L
Initial Position:
( in, in)
Initial Angle:
deg
Current Position: (6 in, 0 in)
Current Angle: 90 deg
Wheel Radius:
Track Width:
in

Robot 3

0
S
M
L
Initial Position:
( in, in)
Initial Angle:
deg
Current Position: (12 in, 0 in)
Current Angle: 90 deg
Wheel Radius:
Track Width:
in

Robot 4

0
S
M
L
Initial Position:
( in, in)
Initial Angle:
deg
Current Position: (18 in, 0 in)
Current Angle: 90 deg
Wheel Radius:
Track Width:
in
CSP Unit 3 Lesson 8.5
/* Code generated by RoboBlockly v2.5 */
#include <robot.h>
CLinkbotI robot;
double radius = 1.75;
double trackwidth = 3.69;

// Describe this function...
void traceSquare(double x, double y, double sideLength) {
  robot.traceOff();
  robot.drivexyTo(x, y, radius, trackwidth);
  robot.traceOn();
  robot.drivexyTo(x + sideLength, y, radius, trackwidth);
  robot.turnLeft(90, radius, trackwidth);
  robot.driveDistance(sideLength, radius);
  robot.turnLeft(90, radius, trackwidth);
  robot.driveDistance(sideLength, radius);
  robot.turnLeft(90, radius, trackwidth);
  robot.driveDistance(sideLength, radius);
  robot.traceOff();
}

robot.setSpeed(6, radius);
robot.traceColor("red", 4);
traceSquare(10, 10, 18);
traceSquare(12, 12, 14);
traceSquare(14, 14, 10);
Load Blocks
Hardware
LArduino
Workspace Show Ch Save File
Problem Statement:

Using the pre-placed code that defines the new version of the traceSquare function, call the function three times to draw a 12x12 square with bottom left corner at the point (10.10), a 10x10 square with bottom left corner at the point (12, 12), and a 8x8 square with bottom left corner at the point (14, 14). (See the hint if you get stuck.)


		
Rubbish bin
Time