SlideShare a Scribd company logo
1 of 8
SWITCHES
BEGINNER
PROGRAMMING
LESSON
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, 2016, (LAST EDIT: 7/04/2016) 2
Switch Blocks
Asking the robot a question and
doing something different 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
© EV3LESSONS.COM, 2016, (LAST EDIT: 7/04/2016) 3
The question being
asked: is the touch
sensor pressed
Run this code if
the answer is no
Run this code if
the answer is yes
Switch Block CHALLENGE 1
Challenge: Write a program that
changes the display based on if
the touch sensor is pressed or not
pressed.
If pressed, your EV3 is happy!
Display a smiley face. If not
pressed, the EV3 is sad! Display a
sad face.
Hint: You will need to use the
display block, loops and switch
blocks!
© EV3LESSONS.COM, 2016, (LAST EDIT: 7/04/2016) 4
Challenge 1 SOLUTION
© EV3LESSONS.COM, 2016, (LAST EDIT: 7/04/2016) 5
Display Block
Display Block
Wait Block
Loop
Touch
Sensor
Selected
Switch Block Challenge 2
Can you write a program that display big eyeballs
if you touch it once and a sad face if you touch it
a second time and toggles back and forth.
© EV3LESSONS.COM, 2016, (LAST EDIT: 7/04/2016) 6
Challenge 2 solution
© EV3LESSONS.COM, 2016, (LAST EDIT: 7/04/2016) 7
Fin de la leçon
8

More Related Content

Similar to Aq switches2 - Beginner

Decision points-and-progress-alerts
Decision points-and-progress-alertsDecision points-and-progress-alerts
Decision points-and-progress-alertsSusan Jenkins
 
Keyboard_Kung_Fu
Keyboard_Kung_FuKeyboard_Kung_Fu
Keyboard_Kung_FuCraig Angus
 
How to Use Clickers in the Classroom
How to Use Clickers in the ClassroomHow to Use Clickers in the Classroom
How to Use Clickers in the ClassroomTheodecia Sonlin
 
Iphone ipad-application
Iphone ipad-applicationIphone ipad-application
Iphone ipad-applicationGuojun Li
 
Insight360 student App for android
Insight360 student App for androidInsight360 student App for android
Insight360 student App for androidWilliam McIntosh
 
Gate questions ec04 2014 praveen someh
Gate  questions ec04 2014 praveen somehGate  questions ec04 2014 praveen someh
Gate questions ec04 2014 praveen somehpraveensomesh
 
Blocos command reference_pdf_78474
Blocos command reference_pdf_78474Blocos command reference_pdf_78474
Blocos command reference_pdf_78474Industrial N°6
 
Quizz buzzer
Quizz buzzerQuizz buzzer
Quizz buzzerDIVYA S
 
Making cross browser tests beautiful (v2 2017)
Making cross browser tests beautiful (v2 2017)Making cross browser tests beautiful (v2 2017)
Making cross browser tests beautiful (v2 2017)Meaghan Lewis
 
What are Clickers?
What are Clickers?What are Clickers?
What are Clickers?smceuen
 
Cs01 2014
Cs01 2014Cs01 2014
Cs01 2014madhesi
 
Super deliverables 15 0303
Super deliverables 15 0303Super deliverables 15 0303
Super deliverables 15 0303Gavin Johns
 

Similar to Aq switches2 - Beginner (20)

Decision points-and-progress-alerts
Decision points-and-progress-alertsDecision points-and-progress-alerts
Decision points-and-progress-alerts
 
Keyboard_Kung_Fu
Keyboard_Kung_FuKeyboard_Kung_Fu
Keyboard_Kung_Fu
 
User Manual - BYJU'S Weekly Test.pptx
User Manual - BYJU'S Weekly Test.pptxUser Manual - BYJU'S Weekly Test.pptx
User Manual - BYJU'S Weekly Test.pptx
 
How to Gamify a MOOC
How to Gamify a MOOCHow to Gamify a MOOC
How to Gamify a MOOC
 
How to Use Clickers in the Classroom
How to Use Clickers in the ClassroomHow to Use Clickers in the Classroom
How to Use Clickers in the Classroom
 
Iphone ipad-application
Iphone ipad-applicationIphone ipad-application
Iphone ipad-application
 
Insight360 student App for android
Insight360 student App for androidInsight360 student App for android
Insight360 student App for android
 
Gate questions ec04 2014 praveen someh
Gate  questions ec04 2014 praveen somehGate  questions ec04 2014 praveen someh
Gate questions ec04 2014 praveen someh
 
Blocos command reference_pdf_78474
Blocos command reference_pdf_78474Blocos command reference_pdf_78474
Blocos command reference_pdf_78474
 
2.1.8 clean code and debugging
2.1.8 clean code and debugging2.1.8 clean code and debugging
2.1.8 clean code and debugging
 
Quizz buzzer
Quizz buzzerQuizz buzzer
Quizz buzzer
 
Making cross browser tests beautiful (v2 2017)
Making cross browser tests beautiful (v2 2017)Making cross browser tests beautiful (v2 2017)
Making cross browser tests beautiful (v2 2017)
 
An color Sensor - Beginner
An   color Sensor - BeginnerAn   color Sensor - Beginner
An color Sensor - Beginner
 
What are Clickers?
What are Clickers?What are Clickers?
What are Clickers?
 
Ag moving straight2 - Beginner
Ag   moving straight2 - BeginnerAg   moving straight2 - Beginner
Ag moving straight2 - Beginner
 
Overview of ODK.pptx
Overview of ODK.pptxOverview of ODK.pptx
Overview of ODK.pptx
 
GATE CS paper 2014
GATE CS paper 2014GATE CS paper 2014
GATE CS paper 2014
 
Cs01 2014
Cs01 2014Cs01 2014
Cs01 2014
 
Super deliverables 15 0303
Super deliverables 15 0303Super deliverables 15 0303
Super deliverables 15 0303
 
Socrative
SocrativeSocrative
Socrative
 

More from Romaric Saounde Tsopnang

More from Romaric Saounde Tsopnang (20)

Aq les conditionnelles - Débutant
Aq   les conditionnelles - DébutantAq   les conditionnelles - Débutant
Aq les conditionnelles - Débutant
 
Ap les boucles - Débutants
Ap   les boucles - DébutantsAp   les boucles - Débutants
Ap les boucles - Débutants
 
Ap loops2 - Beginner
Ap   loops2 - BeginnerAp   loops2 - Beginner
Ap loops2 - Beginner
 
Ao light nxt2 - Beginner
Ao   light nxt2 - BeginnerAo   light nxt2 - Beginner
Ao light nxt2 - Beginner
 
An capteur de couleur - Débutant
An   capteur de couleur - DébutantAn   capteur de couleur - Débutant
An capteur de couleur - Débutant
 
Al capteur tactile - Débutant
Al   capteur tactile - DébutantAl   capteur tactile - Débutant
Al capteur tactile - Débutant
 
Ak custom imagessounds2 - Beginner
Ak   custom imagessounds2 - BeginnerAk   custom imagessounds2 - Beginner
Ak custom imagessounds2 - Beginner
 
Ak image et son standard - Débutant
Ak   image et son standard - DébutantAk   image et son standard - Débutant
Ak image et son standard - Débutant
 
Aj display2 - Beginner
Aj   display2 - BeginnerAj   display2 - Beginner
Aj display2 - Beginner
 
Aj affichage - Débutant
Aj   affichage - DébutantAj   affichage - Débutant
Aj affichage - Débutant
 
Ai turning2 - Beginner
Ai   turning2 - BeginnerAi   turning2 - Beginner
Ai turning2 - Beginner
 
Ai virages - Débutant
Ai   virages - DébutantAi   virages - Débutant
Ai virages - Débutant
 
Ah pseudocode-fr - Débutant
Ah   pseudocode-fr - DébutantAh   pseudocode-fr - Débutant
Ah pseudocode-fr - Débutant
 
Ag deplacement droit - Débutant
Ag   deplacement droit - DébutantAg   deplacement droit - Débutant
Ag deplacement droit - Débutant
 
Af port view2 - Beginner
Af   port view2 - BeginnerAf   port view2 - Beginner
Af port view2 - Beginner
 
Af vue des portes - Débutant
Af   vue des portes - DébutantAf   vue des portes - Débutant
Af vue des portes - Débutant
 
Ae common issues2 - Beginner
Ae   common issues2 - BeginnerAe   common issues2 - Beginner
Ae common issues2 - Beginner
 
Ae problemes frequents - Débutant
Ae   problemes frequents - DébutantAe   problemes frequents - Débutant
Ae problemes frequents - Débutant
 
Ac introduction2 - Beginner
Ac   introduction2 - BeginnerAc   introduction2 - Beginner
Ac introduction2 - Beginner
 
Ac introduction-fr - Débutant
Ac   introduction-fr - DébutantAc   introduction-fr - Débutant
Ac introduction-fr - Débutant
 

Recently uploaded

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....rightmanforbloodline
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...caitlingebhard1
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformWSO2
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringWSO2
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governanceWSO2
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 

Recently uploaded (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 

Aq switches2 - Beginner

  • 2. 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, 2016, (LAST EDIT: 7/04/2016) 2
  • 3. Switch Blocks Asking the robot a question and doing something different 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 © EV3LESSONS.COM, 2016, (LAST EDIT: 7/04/2016) 3 The question being asked: is the touch sensor pressed Run this code if the answer is no Run this code if the answer is yes
  • 4. Switch Block CHALLENGE 1 Challenge: Write a program that changes the display based on if the touch sensor is pressed or not pressed. If pressed, your EV3 is happy! Display a smiley face. If not pressed, the EV3 is sad! Display a sad face. Hint: You will need to use the display block, loops and switch blocks! © EV3LESSONS.COM, 2016, (LAST EDIT: 7/04/2016) 4
  • 5. Challenge 1 SOLUTION © EV3LESSONS.COM, 2016, (LAST EDIT: 7/04/2016) 5 Display Block Display Block Wait Block Loop Touch Sensor Selected
  • 6. Switch Block Challenge 2 Can you write a program that display big eyeballs if you touch it once and a sad face if you touch it a second time and toggles back and forth. © EV3LESSONS.COM, 2016, (LAST EDIT: 7/04/2016) 6
  • 7. Challenge 2 solution © EV3LESSONS.COM, 2016, (LAST EDIT: 7/04/2016) 7
  • 8. Fin de la leçon 8