Spike Prime Rollingruler Activity Brief

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

LEGO®

Education
SPIKE™ Prime
Rolling Ruler
DECOMPOSE CODE AND EXPLORE
VARIABLES AND OPERATORS TO
MAKE A ROLLING MEASURING
DEVICE.

©2020 The LEGO Group


©2020 The LEGO Group
How does it work?
Upgrade your toolbox with this fun digital measuring tool.
Before you build, break down (decompose) the project to understand how it works.

SPIKE Prime Rolling Ruler Parts


Describe the parts the rolling ruler is made of.

Purposes
Predict the purpose of the parts:
• What is the wheel’s purpose?
• What is the force sensor’s purpose?
• What is the light matrix’s purpose?

2 ©2020 The LEGO Group


How does it work?
How does the Rolling Ruler know how to measure distance?
What hints do the code stacks give?

3 ©2020 The LEGO Group


Unpacking the Code: Variables
The Rolling Ruler code features Variables.

Variables
• cm and wheel measurement are the defined
variables.

Wheel Measurement
• You can calculate the circumference of any
wheel with this equation:
C = π * d (C = circumference, π=3.1415…,
d = diameter of your wheel)

Just for fun


The wheel measurement variable is
defined as 17.5 cm. • The circumference of the SPIKE Prime small
wheel is 17.5 cm
This is the circumference of the small
SPIKE Prime wheel.
• Modify the equation above to find out the
diameter

4 ©2020 The LEGO Group


Unpacking the Code: Operators
The Rolling Ruler code features Operators to perform mathematic operations on the variables.

Operators
The Rolling Ruler uses four Operators:
• multiplication
• division
• round: makes the value a whole number
• abs: makes the value an absolute number

The Operators transform the wheel rotations into


cm allowing the Rolling Ruler to display (write) the
measurements in cm when the force sensor is
released.

Perform Operations on Variables


• The four Operator blocks make this equation:
The set block holds an equation made by four Operator blocks.
You can place Operator blocks inside Operator blocks to make equations and round numbers. Wheel measurement (cm) * relative
position of motor (zero degrees) / 360
(degrees)

5 ©2020 The LEGO Group


Code it!
Use the SPIKE Prime Rolling Ruler code or remix it and make it your own.

6 ©2020 The LEGO Group

You might also like