SlideShare a Scribd company logo
6th – Programming LEGO Mindstorms
EV3 (loops and conditionals)
Nestor Benavides
Wait, loops and conditionals
Wait: A block to stop the actions for a determined time.
Loops: Can determine for how long one or multiple actions Will occur.
Conditionals (Switch): Can decide what actions should be taken under
different situations.
Wait Loop Switch
Wait block
The wait block is mainly used to make the block stop all actions for a
determined time (in seconds).
In this example, the brick will wait one second after saying each number.
Loops
This block is able to group multiple actions in it, it defines for how long or how
many times those actions will occur.
Unlimmited: Will happen forever.
Count: Will happen a certain amount of times.
Time indicator: Will happen for a determined time.
Loops
The brick will say “1, 2, 3” forever
The brick will say “1, 2, 3” one time.
The brick will say “1, 2, 3” for 5 seconds
Conditionals
Switch: Is a block in the Software that allows the brick to decide how to act
depending on a situation controlled by the programmer.
Condition: Indicates the sensor to use.
State: What is expected to happen with the sensor?
True/False: Decision to take.
Conditionals
From the image we can say that:
1. We are using a touch sensor connected to port #1.
2. We want to see if the button is being pressed.
3. - If it is pressed, the brick says “START”.
- If it is not pressed, the brick says “STOP”.
Read as:
If button is pressed, say “start”.
Else, say “stop”.
In action (line follower)
The idea is that the sensor is following the line by
always moving on the edge of it (half white, half
black), so the readings will always be between 25 -
45.
Reading= 5 Reading= 35 Reading= 60
Turn Move forward Turn
0 50 100
(aprox)
In action (line follower)
Is the
Reading less
than 10?
Turn Right
Is the
Reading
greater than
50?
Turn Left
Move
forward
Repeat the
program

More Related Content

PPT
Using Your Mouse
ODP
Lesson 18 tac
PPTX
Loops in python including control statements and various test cases
PPTX
Loops in python including control statements and various test cases
PPT
Interm Progr
PPTX
Lesson flow charts 1
PDF
Cs in science_guides
Using Your Mouse
Lesson 18 tac
Loops in python including control statements and various test cases
Loops in python including control statements and various test cases
Interm Progr
Lesson flow charts 1
Cs in science_guides

Similar to 5. conditionals (20)

PPTX
Al touch2 - Beginner
PPTX
While loop
PPT
ev3-software-tutorial-dc terminologia en ibgles.ppt
PDF
Notes2
PDF
Knockdetectingdoorlockresearchpaper 130303064828-phpapp02
DOCX
Bio 102 – City College of New York – Biology Dept.Experiment 2
PDF
How invariants help writing loops
PPT
Basic Electricity Measuring InstrumentsMultimeters.ppt
PDF
Use of an Oscilloscope - maXbox Starter33
PDF
Práctica 1 a 7 m bot ingles
PDF
Angus Fletcher - Error Handling in Concurrent Systems
PDF
Repetition Control Structure_lsson 3.pdf
PPTX
Embedded systems semaphore topic wise notes
PPSX
Invention stimulator online presentation
PPTX
Going loopy - Introduction to Loops.pptx
DOCX
C++ Loops General Discussion of Loops A loop is a.docx
PPTX
Scratch workshop by Aarav (1) scratch.pptx
DOCX
Scratch for kids syllabus for 5 hours by bibek pandit
PPTX
Mastering Python lesson 3a
PDF
Joint-level Force Sensing for a Soft Robot Manipulator
Al touch2 - Beginner
While loop
ev3-software-tutorial-dc terminologia en ibgles.ppt
Notes2
Knockdetectingdoorlockresearchpaper 130303064828-phpapp02
Bio 102 – City College of New York – Biology Dept.Experiment 2
How invariants help writing loops
Basic Electricity Measuring InstrumentsMultimeters.ppt
Use of an Oscilloscope - maXbox Starter33
Práctica 1 a 7 m bot ingles
Angus Fletcher - Error Handling in Concurrent Systems
Repetition Control Structure_lsson 3.pdf
Embedded systems semaphore topic wise notes
Invention stimulator online presentation
Going loopy - Introduction to Loops.pptx
C++ Loops General Discussion of Loops A loop is a.docx
Scratch workshop by Aarav (1) scratch.pptx
Scratch for kids syllabus for 5 hours by bibek pandit
Mastering Python lesson 3a
Joint-level Force Sensing for a Soft Robot Manipulator
Ad

More from Nestor Benavides (11)

PPTX
3.1 coding (project)
PPTX
Sculptris
PPTX
Domotics: New Arduino components
PPTX
Marketing and products creation
PPTX
Designing products and automation
PPTX
Line follOwer
PPTX
Resistors and breadboard
PPTX
Electricity and basic components
PPTX
4. sensors
PPTX
Welcome myp
PPTX
Welcome PYP
3.1 coding (project)
Sculptris
Domotics: New Arduino components
Marketing and products creation
Designing products and automation
Line follOwer
Resistors and breadboard
Electricity and basic components
4. sensors
Welcome myp
Welcome PYP
Ad

Recently uploaded (20)

PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
Hazard Identification & Risk Assessment .pdf
PPTX
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
20th Century Theater, Methods, History.pptx
PPTX
Introduction to Building Materials
PPTX
TNA_Presentation-1-Final(SAVE)) (1).pptx
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
Trump Administration's workforce development strategy
PDF
1_English_Language_Set_2.pdf probationary
PDF
My India Quiz Book_20210205121199924.pdf
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
Introduction to pro and eukaryotes and differences.pptx
Weekly quiz Compilation Jan -July 25.pdf
Hazard Identification & Risk Assessment .pdf
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
20th Century Theater, Methods, History.pptx
Introduction to Building Materials
TNA_Presentation-1-Final(SAVE)) (1).pptx
What if we spent less time fighting change, and more time building what’s rig...
Trump Administration's workforce development strategy
1_English_Language_Set_2.pdf probationary
My India Quiz Book_20210205121199924.pdf
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...

5. conditionals

  • 1. 6th – Programming LEGO Mindstorms EV3 (loops and conditionals) Nestor Benavides
  • 2. Wait, loops and conditionals Wait: A block to stop the actions for a determined time. Loops: Can determine for how long one or multiple actions Will occur. Conditionals (Switch): Can decide what actions should be taken under different situations. Wait Loop Switch
  • 3. Wait block The wait block is mainly used to make the block stop all actions for a determined time (in seconds). In this example, the brick will wait one second after saying each number.
  • 4. Loops This block is able to group multiple actions in it, it defines for how long or how many times those actions will occur. Unlimmited: Will happen forever. Count: Will happen a certain amount of times. Time indicator: Will happen for a determined time.
  • 5. Loops The brick will say “1, 2, 3” forever The brick will say “1, 2, 3” one time. The brick will say “1, 2, 3” for 5 seconds
  • 6. Conditionals Switch: Is a block in the Software that allows the brick to decide how to act depending on a situation controlled by the programmer. Condition: Indicates the sensor to use. State: What is expected to happen with the sensor? True/False: Decision to take.
  • 7. Conditionals From the image we can say that: 1. We are using a touch sensor connected to port #1. 2. We want to see if the button is being pressed. 3. - If it is pressed, the brick says “START”. - If it is not pressed, the brick says “STOP”. Read as: If button is pressed, say “start”. Else, say “stop”.
  • 8. In action (line follower) The idea is that the sensor is following the line by always moving on the edge of it (half white, half black), so the readings will always be between 25 - 45. Reading= 5 Reading= 35 Reading= 60 Turn Move forward Turn 0 50 100 (aprox)
  • 9. In action (line follower) Is the Reading less than 10? Turn Right Is the Reading greater than 50? Turn Left Move forward Repeat the program