Variables
Variables
By the Makers of
EV3Lessons
VARIABLES
BY SANJAY AND ARVIND SESHAN
LESSON OBJECTIVES
Once you have created the variable, In the example below, Circumference
it will appear in the menu bar. is set to the circumference of the EV3
Educator robot wheel in centimeters.
Circumference = Pi X Wheel Diameter
Circumference = 3.14 X 5.6
Once you have created the variable, In the example below, counter
it will appear in the menu bar. is initialized to 1. The change
by 2 will add 2 to the counter.
The display block will show a 3
on the screen since 1 + 2 = 3
Note that you can change by a
negative number as well – this
will subtract from the variable.
Challenge 1:
Challeng
Can you make a program that displays the
e2
number of times that you have pressed the left FINISH
button?
Challenge 2:
Can you write a program that counts the
number of black lines you have crossed?
STAR
T
Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 5/3
0/2020)
1
SOLUTION: COUNT CLICKS
This lesson was created by Sanjay Seshan and Arvind Seshan for Prime
Lessons
More lessons are available at www.primelessons.org