BEGINNER EV3
PROGRAMMING
LESSON
Topics Covered:
EV3 Basics
Introduction to the EV3 Brick and Software
LESSON OBJECTIVES
1. Learn how the EV3 brick operates
2. Learn about the main components of the EV3 software
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 2
THE “BRICK” BUTTONS
1 = Back 1
Undo 3
Stop Program
Turn robot off 3 23
3
2 = Center Button
Select options 3
Run Program
Turn robot on
3 = L, R, Up, Down
Navigate menus
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015)
THE “BRICK” SCREEN
Tabs on Screen
12 34 1. Run Recent
Find programs you ran
recently
2. File Navigation
Find all programs by project
3. Brick Apps
Port views
4. Settings
Bluetooth, Wifi, Volume
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 4
PORTS, SENSORS, MOTORS
Ports A, B, C, D = Motors
Default setup assumes Right
Motor in C, Left Motor in B
B Front
Default
setup
C
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) Ports 1, 2, 3, 4 = Sensors 5
EV3 SOFTWARE
Open Saved Project
Open New Project
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 6
EV3 SOFTWARE: STARTING A
NEW PROGRAM Create a Project
Opened Opened Programs
Projects Create a Program
Project Properties
List of programs 7
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015)
PROJECTS VS. PROGRAMS
• You will start by creating a PROJECT which has a .ev3 extension. You
change the name of a project by using the Save Project As option from the
the File menu.
• You will write many PROGRAMS as part of each PROJECT file. You change
the name of a program within a project by doubling clicking on the program’s
tab and typing in a new name.
• Note: If there is an * next to the project name, you have made changes to
the project and you have not yet saved yet.
• There is a “x” next to project and program names. Clicking on it simply
closes the file (it does not get deleted).
Here are some common file extensions in the EV3:
• Programs (.ev3p)
• Images (.rgf)
• Sounds (.rsf)
• Text (.rtf)
• Projects (.ev3) – the only type of file you can open with the EV3 software
• Import file (.ev3s) – can be imported by an EV3 project
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 8
EV3 SOFTWARE:
PROGRAMMING SCREEN
Programming
Area or
Canvas
Programming Blocks in Brick Status &
6 Colored Tabs Downloading
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 9
USEFUL ICONS 7
1 23 4 5 6
1. List Programs in Project: List of all programs in the project
2. Select: The cursor looks like an arrow and you can pick specific blocks
or areas of the screen
3. Pan: The cursor looks like a hand. When you click and move the
mouse, you can move through the program when it goes beyond one
screen.
4. Comments: Click on this icon to create the comment box
5. Save Project: Save the current version of your project
6. Undo and Redo: Undo or redo the last actions
7. Zoom Out, Zoom In, and Reset Zoom: Use to decrease, increase or
reset the magnification
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 10
EV3 BLOCKS: COLORED TABS
ACTION BLOCKS FLOW BLOCKS SENSOR BLOCKS
Move, Large & Medium Start, Wait, Loop, Brick Buttons, Gyro,
Switch, Loop Interrupt 2
Motor, Display… 1 Color, Ultrasonic 3
123 4 56
DATA OPERATIONS ADVANCED BLOCKS MY BLOCKS
Variables, Array, Logic, Data Logging,
Custom Blocks you
Math, Compare… 4 Unregulated Motor… 5
create 6
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 11
BEGINNER EV3
PROGRAMMING
LESSON
Using Sensor Data and Port View
LESSON OBJECTIVES
1. Learn how to retrieve and use data from your sensors
2. Learn how to use Port View on the EV3 Brick
3. Learn some examples of when and where Port View would be
useful
4. Try to solve some common problems using Port View
© EV3Lessons.com, 2015, (Last edit: 11/04/2015) 13
WHY DO YOU NEED SENSOR
DATA?
Sensor data can be….
• Used to help program more easily (no more guess and check!!)
• Used to help program more accurately
• Used to debug code as well as build issues
PORT VIEW is an easy way to access SENSOR DATA!
© EV3Lessons.com, 2015, (Last edit: 11/04/2015) 14
HOW DO YOU GET TO PORT
VIEW?
• Step 1:
• Click the Left or Right buttons
on the brick until you get to the
third tab on the screen (icon
with six small circles).
• The first choice in this tab is
Port View. (Click the middle
button on the brick to select
Port View)
• Step 2: Left Right
• Use the Left and Right Buttons
to pick the port and
sensor/motor you want
All images of the EV3 Brick in this lesson were obtained using screenshots of Cogmation’s Virtual Robotics Toolkit. 15
© EV3Lessons.com, 2015, (Last edit: 11/04/2015)
WHAT YOU SEE IN PORT VIEW
A. PORT Number A B C
B. SENSOR/MOTOR & A B D
MODE
C. If you select a
particular sensor (middle
button on brick), you can
change the MODE
D. VALUE . You might
want to start at “0” (e.g.
If trying to measure
degrees for a turn). To
reset the value, exit Port
View and return to back
to this screen.
All images of the EV3 Brick in this lesson were obtained using screenshots of Cogmation’s Virtual Robotics Toolkit. 16
© EV3Lessons.com, 2015, (Last edit: 11/04/2015)
MOVE STRAIGHT CHALLENGE
CHALLENGE: Move your robot forward from 1 FINISH
the start line to the finish line (1) and back to 2
the start (2).
START
In the Moving Straight Lesson, you had to
use a lot of guess and check to stop exactly B
on the second line. C
Now try Port View:
• Go to one of the rotation sensors (Motor B
or C for our robot on the right)
• Make sure it is on degrees as the mode
and that it starts at 0 degrees.
• Move your robot with your hand from the
start line to the end line. Make sure that
your wheel turns smoothly and doesn’t slip
as the robot moves.
• Read how many degrees your robot moved
• Use this number in the Move Steering
Block to move the correct distance.
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 17
PORT VIEW IS POWERFUL
As you go through the rest of the lessons on EV3Lessons.com,
you will use Port View often
As you complete each challenge, think about how Port View might
help you.
The next page has many several examples to think about.
© EV3Lessons.com, 2015, (Last edit: 11/04/2015) 18
OTHER PROBLEMS YOU CAN
SOLVE WITH PORT VIEW
Challenge 1: Program Easier/More Accurately
I want to go from a starting point up to a LEGO model. I keep having to guess and check.
How can I figure out how far away the LEGO model is?
Challenge 2: Program Easier/More Accurately
I want my robot to turn 90 degrees. But 90 degrees in the real world is not 90 degrees in
the steering block. So, how much does my robot have to turn to make a 90 degree turn?
Challenge 3: Debug Code
The robot does not folllow the green line like I programmed it to do. Why not? What color
does the robot think that green line is? Try placing the robot on different objects or parts
of mat/picture – what colors or reflected light values does the sensor read
Challenge 4: Check Builds
I built my robot with the touch sensor a little bit inside the robot. I am not sure that the
touch sensor is getting pressed enough. How can I make sure the sensor is getting
pressed?
Challenge 5: Test Sensors 19
I told my robot to stop when the Ultrasonic sensor is 20cm away. But it seems to stop
earlier. Is the sensor working correctly? How can I see what the ultrasonic sensor sees?
© EV3Lessons.com, 2015, (Last edit: 11/04/2015)
BEGINNER EV3
PROGRAMMING
LESSON
Topics Covered:
Display Block
LESSON OBJECTIVES
1. Learn to use the Display Block to display text and images
2. Understand why the Display Block can be useful in
programming
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 21
DISPLAY BLOCK 22
• The Display Block to show
information and pictures on
the screen
• You can control the location
and size of text
• You can use this same block
to display sensor readings
and instructions.
• Located in Green Tab
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015)
MORE ON DISPLAY BLOCKS
Two modes to display
Pixel mode (Use for displaying images or text)
• 178 pixels left and right
• 128 pixels up and down
Grid mode (Easier to use, only works for text mode)
• 22 columns of 8 pixels each
• 12 rows of 10 pixels each
• Small characters are 1 row and 1 column
• Large characters are 2 rows and 2 columns
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 23
DISPLAYING TEXT IN GRID
MODE
Step 1: Display Text to be
Pick Display Block Preview displayed
Step 2: Switch Text size
Click on “Switch Modes” icon Modes 0 – small font
and hover over “text”. Then Erase Screen 1 – small, bold font
click on “grid”. The icon will 2 – large font
change into a square with Column to start
dots. display
Step 3: Row to start display
Use the box on the top right to
enter the text you want to Black/White Display
display
Text Size
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 24
DISPLAY BLOCK CHALLENGE 1
Can you write a program to display text in the middle of the
screen?
• Display “Hello World”
Make the display block run for 3 seconds
Can you also move while doing this?
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 25
CHALLENGE 1 SOLUTION
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 26
DISPLAYING AN IMAGE IN PIXEL
MODE
Step 1:
Pick Display Block
Step 2:
Click on the “Select Mode”
which has a folder icon and
pick “image”
Step 3:
Use the empty box on the top
right to pick the image you
want to display
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 27
DISPLAY BLOCK CHALLENGE 2
Can you display eyes on the
screen while moving? Alternate
eyeballs that look left and right.
• Use the Display Block,
Motor On and Wait
Block
• Feel free to have fun with
this challenge and make it
yours!
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 28
CHALLENGE 2 SOLUTION
Motor On Display Wait Motor
Block Block Off
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 29
DISCUSSION GUIDE
Why might you want to know how to use the display block?
• You might want to know what the sensor value your robot is seeing
• You might have to program a robot to stop when the robot reaches
a red line but it stops before
• Does the robot see the same thing you see?
• You can display the value on the screen and check
It’s a great debugging tool. You can learn more about debugging
code in one of our Intermediate lessons.
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 30
BEGINNER EV3
PROGRAMMING
LESSON
Topics Covered:
Moving Straight
LESSON OBJECTIVES
1. Learn how to make your robot go forward and backwards
2. Learn how to use the Move Steering block
3. Learn how to read sensor values using Port View
© EV3Lessons.com, 2015, (Last edit: 2/26/2015) 32
MOVE STEERING BLOCK
B
Mode of C
operation
Brake/
Coast
Steering: Straight or turn Power/Speed Duration/Distance
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 33
NEGATIVE & POSITIVE POWER:
BACKWARD & FORWARD
Negative Power =
Backwards
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) Positive Power
= Forward
34
HOW DO YOU MOVE STRAIGHT?
STEP 1: Green Block Tab, Click
and hold Move Steering and
drag to programming area
STEP 2: Drop next to the Start
Block (green arrow)
(See animation)
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 35
CHALLENGE 1: MOVE STRAIGHT
(3 SECONDS)
Step 3 STEP 1: Green Block Tab, Click
and hold Move Steering and
Step 4 drag to programming area
Step 5
STEP 2: Drop next to the Start
Block (green arrow)
STEP 3: Select Options. Move “3
Seconds”
STEP 4: Connect USB cable to
EV3 and Laptop.
STEP 5: Download to EV3
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 36
TEACHER INSTRUCTIONS
• Split up class into groups as need
• Give each team a copy of the Move Straight
Challenge Worksheet
• Challenge Details are on Slide 8
• Discussion Page Slide 9
• Challenge Solution on Slide 10
• A Better Way on Slide 11
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 37
MOVE STRAIGHT: SECONDS VS.
DEGREES VS. ROTATIONS
CHALLENGE: Move your robot FINISH 2
forward from the start line to the 1
finish line (1) and back to the start
(2).
Try mode SECONDS, DEGREES or
ROTATIONS and adjust
duration/distance
Try different speeds
B
C
START
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 38
MOVE STRAIGHT DISCUSSION 39
Did you guess and check a lot?
Yes. Programming with seconds, rotations and
degrees using guess and check takes a lot of time
and effort.
Did changing the speed matter?
Yes. When you move in seconds your speed will
matter.
Do you think the wheel size will matter? Why?
Wheel size affects degrees/rotations.
Do you this the battery level will matter? Why?
When you move in seconds, battery levels change
the power.
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015)
CHALLENGE SOLUTION
This would be changed for
degrees or seconds
• There is a better way (go to slide 11) to solve this challenge
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 40
SOLUTION: USE PORT VIEW
Try “port view” on brick (on Brick Apps tab)
• Move your robot with your hand from your start line to your end line
• Read how many degrees your robot moved
• Use this number in the Move Steering Block to move the correct
distance.
Copyright © EV3Lessons.com 2015 (Last edit: 2/26/2015) 41
BEGINNER EV3
PROGRAMMING
LESSON
Topics Covered:
Repeating Actions (Loops)
LESSON OBJECTIVES
1. Learn how to repeat an action
2. Learn how to use Loop Blocks
© EV3Lessons.com, 2015, (Last edit: 2/26/2015) 43
REPEATING AN ACTION 44
How can we move around a box
using the commands we already
know?
• (move + turn) + (move + turn) + (move + turn) …
Loops make repeating a task multiple times easy
Is there an easier way?
Hint:
© EV3Lessons.com, 2015, (Last edit: 2/26/2015)
LOOPS
Loops make repeating a task multiple times easy
• KEEP GOING….Forever, for a Count, Until touch (or something
else)
© EV3Lessons.com, 2015, (Last edit: 2/26/2015) 45
LOOP CHALLENGE
Challenge: Write a program to go around a box until touched. You
must use a LOOP
© EV3Lessons.com, 2015, (Last edit: 2/26/2015) 46
LOOP CHALLENGE SOLUTION
© EV3Lessons.com, 2015, (Last edit: 2/26/2015) 47
BEGINNER EV3
PROGRAMMING
LESSON
Topics Covered:
Switches
LESSON OBJECTIVES
1. Learn how to make your robot decide what to do out of
different choices
2. Learn how to use a Switch Block
© EV3Lessons.com, 2015, (Last edit: 2/26/2015) 49
SWITCH BLOCKS
Asking the robot a question Run this code if
and doing something different the answer is yes
based on the answer
• Example: Does the robot see
a line? Or not?
Basically a YES/NO
QUESTION
Switch blocks are found in the
orange/flow tab
The question being Run this code if
asked: is the touch the answer is no
sensor pressed
50
© EV3Lessons.com, 2015, (Last edit: 2/26/2015)