Learning Math and CS/STEAM with Robotics
Sign In

CSP Unit 3 Lesson 5.7

Linkbot Image Mindstorm Image
Grid Size: S M L Simple View: MinView:
CSP Unit 3 Lesson 5.7

Once we define a function, we can use it within other functions that we create. For example, it would be nice to have a "drawRectangle" function. To create one, take the code that draws a rectangle (as shown), which includes the traceOn, driveDistance, "right", and traceOff commands, and move it into a new function named drawRectangle using the pre-placed function block. Then add code that calls the drawRectangle function at the beginning of the program (after traceColor). Note that the function definition for "right" is pre-placed at the end for you.

Workspace Load Save Ch Ch Shell Console
Rubbish bin