SlideShare ist ein Scribd-Unternehmen logo
1 von 22
VEX Robotics I Power Points
                             Topic 09
                    Programming Design Basics
                     Bumper Switch Sensing 1
www.pedagogics.ca
Topics Covered in this Presentation
               Topic 09
               • Introduction to the bumper switch
               • flowcharting and writing pseudocode


               •program sketch #1
                  • while loops and Boolean logic
                  • if else loops and sensor input
Bumper Switch
(digital sensor)




      Usually positioned on front of robot.
      Output is either a 1 (depressed) or a 0




                                          0
Bumper Switch
(digital sensor)




      Usually positioned on front of robot.
      Output is either a 1 (depressed) or a 0




                                          1
Bumper Switch
(digital sensor)




      Usually positioned on front of robot.
      Output is either a 1 (depressed) or a 0




                                          0
Bumper Switch
(digital sensor)




      Usually positioned on front of robot.
      Output is either a 1 (depressed) or a 0




                                          1
Program sketch #1
Write a simple program to make your robot drive forward
indefinitely , but will stop, turn 180o and continue driving if
the robot encounters an obstacle.


                    STEP 1 – FLOWCHART
                       • thinking about how ROBOTC works


                    STEP 2 – PSEUDOCODE


                    STEP 3 – ACTUAL CODE
Flowchart Symbols
START          Flow chart describes behavior
                          sequence.
          DRIVE
        FORWARD
                          This flowchart gives us the basic
NO
                          idea of what behaviors we want to
          Switch
          pressed         see in our robot.
             ?


       YES                The flowchart however is overly
                          simplified and needs a few extras to
     Stop, reverse, 180
        degree turn       make it easily transferable to code.
Cannot use a wait statement because we want
             START        the robot to perform two functions alternately
                          (essentially simultaneously)


                                         IF
                      Always          Switch          TRUE
             WHILE                                             DRIVE
                                        not
             LOOP ?
                      infinite        pressed                FORWARD
Move
on                    loop               ?

                                            FALSE

       END                       Stop, reverse, 180
                                    degree turn
DECISIONS must     This type of question is called a Boolean
be thought of as   statement.
 questions that
can be answered    The answer is called a “truth value” and
   YES or NO       the answer is only valid at the time the
 TRUE or FALSE     question is asked.

                   You used a Boolean statement in the
                   remote control coding for Tumbler
Valid “comparison operators” in ROBOTC
START




Pseudo code - basic commands, comments about
functions and behaviors

This code will never compile

Forms the backbone of your program and translates
from the flowchart to ROBOTC
IF , ELSE boolean statement used to check
             bumper switch. If switch is not pressed, robot
START        drives forward



                         IF
         Always       Switch     TRUE
WHILE                                         DRIVE
                        not
LOOP ?
         infinite     pressed               FORWARD
         loop            ?
IF , ELSE boolean statement used to check
START        bumper switch. If switch is not pressed, robot
             drives forward


                         IF
         Always       Switch     TRUE
WHILE                                         DRIVE
                        not
LOOP ?
         infinite     pressed               FORWARD
         loop            ?
If switch is pressed – ELSE – the stop and turn
START        behavior occurs, then robot returns to moving
             forward (unless what is happening?)


                            IF
         Always          Switch          TRUE
WHILE                                             DRIVE
                           not
LOOP ?
         infinite        pressed                FORWARD
         loop               ?

                               FALSE

                    Stop, reverse, 180
                       degree turn
START



                                         IF
                      Always          Switch          TRUE
             WHILE                                             DRIVE
                                        not
             LOOP ?
                      infinite        pressed                FORWARD
Move
on                    loop               ?

                                            FALSE

       END                       Stop, reverse, 180
                                    degree turn
Programming with sensors   bumper switch 1

Weitere ähnliche Inhalte

Was ist angesagt?

Odoo icon smart buttons
Odoo   icon smart buttonsOdoo   icon smart buttons
Odoo icon smart buttonsTaieb Kristou
 
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...Codemotion
 
Future of Robotics Technology.pptx
Future of Robotics Technology.pptxFuture of Robotics Technology.pptx
Future of Robotics Technology.pptxApurbaRoy48
 
5 Simple Tips for Troubleshooting Your Kubernetes Pods
5 Simple Tips for Troubleshooting Your Kubernetes Pods5 Simple Tips for Troubleshooting Your Kubernetes Pods
5 Simple Tips for Troubleshooting Your Kubernetes PodsCodefresh
 
Odoo - Business intelligence: Develop cube views for your own objects
Odoo - Business intelligence: Develop cube views for your own objectsOdoo - Business intelligence: Develop cube views for your own objects
Odoo - Business intelligence: Develop cube views for your own objectsOdoo
 
Create Products in Odoo 15
Create Products in Odoo 15 Create Products in Odoo 15
Create Products in Odoo 15 Celine George
 
Sergii Kharagorgiiev, Chief Computer Vision Engineer at Starship Technologies...
Sergii Kharagorgiiev, Chief Computer Vision Engineer at Starship Technologies...Sergii Kharagorgiiev, Chief Computer Vision Engineer at Starship Technologies...
Sergii Kharagorgiiev, Chief Computer Vision Engineer at Starship Technologies...Codiax
 

Was ist angesagt? (12)

Odoo icon smart buttons
Odoo   icon smart buttonsOdoo   icon smart buttons
Odoo icon smart buttons
 
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...
 
Future of Robotics Technology.pptx
Future of Robotics Technology.pptxFuture of Robotics Technology.pptx
Future of Robotics Technology.pptx
 
5 Simple Tips for Troubleshooting Your Kubernetes Pods
5 Simple Tips for Troubleshooting Your Kubernetes Pods5 Simple Tips for Troubleshooting Your Kubernetes Pods
5 Simple Tips for Troubleshooting Your Kubernetes Pods
 
Odoo - Business intelligence: Develop cube views for your own objects
Odoo - Business intelligence: Develop cube views for your own objectsOdoo - Business intelligence: Develop cube views for your own objects
Odoo - Business intelligence: Develop cube views for your own objects
 
Robotics
RoboticsRobotics
Robotics
 
Odoo experience 2018 - Odoo Documents
Odoo experience 2018 - Odoo DocumentsOdoo experience 2018 - Odoo Documents
Odoo experience 2018 - Odoo Documents
 
ROBOTICS IN SCHOOLS
ROBOTICS IN SCHOOLSROBOTICS IN SCHOOLS
ROBOTICS IN SCHOOLS
 
Application of embeddd system
Application of embeddd systemApplication of embeddd system
Application of embeddd system
 
Create Products in Odoo 15
Create Products in Odoo 15 Create Products in Odoo 15
Create Products in Odoo 15
 
Sergii Kharagorgiiev, Chief Computer Vision Engineer at Starship Technologies...
Sergii Kharagorgiiev, Chief Computer Vision Engineer at Starship Technologies...Sergii Kharagorgiiev, Chief Computer Vision Engineer at Starship Technologies...
Sergii Kharagorgiiev, Chief Computer Vision Engineer at Starship Technologies...
 
Humanoid robots
Humanoid robotsHumanoid robots
Humanoid robots
 

Andere mochten auch

Programming with sensors bumper switch 3
Programming with sensors   bumper switch 3Programming with sensors   bumper switch 3
Programming with sensors bumper switch 3David Young
 
Programming with sensors bumper switch 2
Programming with sensors   bumper switch 2Programming with sensors   bumper switch 2
Programming with sensors bumper switch 2David Young
 
1.5 projectile motion
1.5    projectile motion1.5    projectile motion
1.5 projectile motionDavid Young
 
kls xii : Bab iii pers dlm masyarakat
kls xii : Bab iii pers dlm masyarakatkls xii : Bab iii pers dlm masyarakat
kls xii : Bab iii pers dlm masyarakatNovii Kanadia
 
II Kongres eHandlu: Piotr Chmielewski, Social Media Now - "Kampanie reklamowe...
II Kongres eHandlu: Piotr Chmielewski, Social Media Now - "Kampanie reklamowe...II Kongres eHandlu: Piotr Chmielewski, Social Media Now - "Kampanie reklamowe...
II Kongres eHandlu: Piotr Chmielewski, Social Media Now - "Kampanie reklamowe...ecommerce poland expo
 
Iman bysajib hossain akash-01725-340978.
Iman bysajib hossain akash-01725-340978.Iman bysajib hossain akash-01725-340978.
Iman bysajib hossain akash-01725-340978.Sajib Hossain Akash
 
Top 8 chief business development officer resume samples
Top 8 chief business development officer resume samplesTop 8 chief business development officer resume samples
Top 8 chief business development officer resume samplesporichfergu
 
Yliko pake geniko_meros_201105.20-27
Yliko pake geniko_meros_201105.20-27Yliko pake geniko_meros_201105.20-27
Yliko pake geniko_meros_201105.20-27Nikos Kaklamanos
 
Sweden Presetasion
Sweden PresetasionSweden Presetasion
Sweden Presetasionoldusel
 
DDD Sydney 2011 - Getting out of Sync with IIS and Riding a Comet
DDD Sydney 2011 - Getting out of Sync with IIS and Riding a CometDDD Sydney 2011 - Getting out of Sync with IIS and Riding a Comet
DDD Sydney 2011 - Getting out of Sync with IIS and Riding a CometRichard Banks
 
Earned value management lecture 2009e my31
Earned value management lecture 2009e my31Earned value management lecture 2009e my31
Earned value management lecture 2009e my31rongo620
 
ニコニコ動画でのHTML5
ニコニコ動画でのHTML5ニコニコ動画でのHTML5
ニコニコ動画でのHTML5Sho KUSANO
 
Technological applications and innovations
Technological applications and innovationsTechnological applications and innovations
Technological applications and innovationsrbulalakaw
 
The Regacy Chapter 5.4b Ink - Emma
The Regacy Chapter 5.4b Ink - EmmaThe Regacy Chapter 5.4b Ink - Emma
The Regacy Chapter 5.4b Ink - Emmaregacylady
 
Business is fun: Shopping in madrid
Business is fun: Shopping in madridBusiness is fun: Shopping in madrid
Business is fun: Shopping in madridsarasacristan
 

Andere mochten auch (20)

Programming with sensors bumper switch 3
Programming with sensors   bumper switch 3Programming with sensors   bumper switch 3
Programming with sensors bumper switch 3
 
Programming with sensors bumper switch 2
Programming with sensors   bumper switch 2Programming with sensors   bumper switch 2
Programming with sensors bumper switch 2
 
1.5 projectile motion
1.5    projectile motion1.5    projectile motion
1.5 projectile motion
 
Intro to RobotC
Intro to RobotCIntro to RobotC
Intro to RobotC
 
Uso del scr
Uso del scrUso del scr
Uso del scr
 
kls xii : Bab iii pers dlm masyarakat
kls xii : Bab iii pers dlm masyarakatkls xii : Bab iii pers dlm masyarakat
kls xii : Bab iii pers dlm masyarakat
 
II Kongres eHandlu: Piotr Chmielewski, Social Media Now - "Kampanie reklamowe...
II Kongres eHandlu: Piotr Chmielewski, Social Media Now - "Kampanie reklamowe...II Kongres eHandlu: Piotr Chmielewski, Social Media Now - "Kampanie reklamowe...
II Kongres eHandlu: Piotr Chmielewski, Social Media Now - "Kampanie reklamowe...
 
Iman bysajib hossain akash-01725-340978.
Iman bysajib hossain akash-01725-340978.Iman bysajib hossain akash-01725-340978.
Iman bysajib hossain akash-01725-340978.
 
Top 8 chief business development officer resume samples
Top 8 chief business development officer resume samplesTop 8 chief business development officer resume samples
Top 8 chief business development officer resume samples
 
Yliko pake geniko_meros_201105.20-27
Yliko pake geniko_meros_201105.20-27Yliko pake geniko_meros_201105.20-27
Yliko pake geniko_meros_201105.20-27
 
Shi20396 ch04
Shi20396 ch04Shi20396 ch04
Shi20396 ch04
 
Sweden Presetasion
Sweden PresetasionSweden Presetasion
Sweden Presetasion
 
DDD Sydney 2011 - Getting out of Sync with IIS and Riding a Comet
DDD Sydney 2011 - Getting out of Sync with IIS and Riding a CometDDD Sydney 2011 - Getting out of Sync with IIS and Riding a Comet
DDD Sydney 2011 - Getting out of Sync with IIS and Riding a Comet
 
Earned value management lecture 2009e my31
Earned value management lecture 2009e my31Earned value management lecture 2009e my31
Earned value management lecture 2009e my31
 
2nd Easter A(2)
2nd Easter A(2)2nd Easter A(2)
2nd Easter A(2)
 
ASI Financials 2011 Brochure
ASI Financials 2011 BrochureASI Financials 2011 Brochure
ASI Financials 2011 Brochure
 
ニコニコ動画でのHTML5
ニコニコ動画でのHTML5ニコニコ動画でのHTML5
ニコニコ動画でのHTML5
 
Technological applications and innovations
Technological applications and innovationsTechnological applications and innovations
Technological applications and innovations
 
The Regacy Chapter 5.4b Ink - Emma
The Regacy Chapter 5.4b Ink - EmmaThe Regacy Chapter 5.4b Ink - Emma
The Regacy Chapter 5.4b Ink - Emma
 
Business is fun: Shopping in madrid
Business is fun: Shopping in madridBusiness is fun: Shopping in madrid
Business is fun: Shopping in madrid
 

Mehr von David Young

1.4 acceleration
1.4   acceleration1.4   acceleration
1.4 accelerationDavid Young
 
1.2 displacement and position vs time graphs
1.2   displacement and position vs time graphs1.2   displacement and position vs time graphs
1.2 displacement and position vs time graphsDavid Young
 
2016 topic 5.2 hess's law
2016   topic 5.2  hess's law2016   topic 5.2  hess's law
2016 topic 5.2 hess's lawDavid Young
 
2016 topic 5.1 measuring energy changes
2016   topic 5.1 measuring energy changes2016   topic 5.1 measuring energy changes
2016 topic 5.1 measuring energy changesDavid Young
 
2016 topic 4.5 bonding - metallic
2016   topic 4.5 bonding - metallic2016   topic 4.5 bonding - metallic
2016 topic 4.5 bonding - metallicDavid Young
 
2016 topic 4.1 bonding - ionic
2016   topic 4.1 bonding - ionic2016   topic 4.1 bonding - ionic
2016 topic 4.1 bonding - ionicDavid Young
 
2016 topic 4.2 bonding - covalent
2016   topic 4.2  bonding - covalent2016   topic 4.2  bonding - covalent
2016 topic 4.2 bonding - covalentDavid Young
 
Unit 4 2014 ppt sound
Unit 4 2014  ppt    soundUnit 4 2014  ppt    sound
Unit 4 2014 ppt soundDavid Young
 
Unit 4 2014 ppt wave characteristics
Unit 4 2014  ppt    wave characteristicsUnit 4 2014  ppt    wave characteristics
Unit 4 2014 ppt wave characteristicsDavid Young
 
2016 topic 01 part 1
2016 topic 01   part 12016 topic 01   part 1
2016 topic 01 part 1David Young
 
Chemistry 1 - Atomic Structure
Chemistry 1 - Atomic StructureChemistry 1 - Atomic Structure
Chemistry 1 - Atomic StructureDavid Young
 
2016 Topic 2: Electron Configuration
2016  Topic 2: Electron Configuration2016  Topic 2: Electron Configuration
2016 Topic 2: Electron ConfigurationDavid Young
 
2016 Topic 2: Atomic Structure
2016 Topic 2: Atomic Structure2016 Topic 2: Atomic Structure
2016 Topic 2: Atomic StructureDavid Young
 
2016 topic 0 - oxidation and reduction (INTRODUCTION)
2016   topic 0 - oxidation and reduction (INTRODUCTION)2016   topic 0 - oxidation and reduction (INTRODUCTION)
2016 topic 0 - oxidation and reduction (INTRODUCTION)David Young
 
2016 topic 0 - elements & periodic table
2016   topic 0 - elements & periodic table2016   topic 0 - elements & periodic table
2016 topic 0 - elements & periodic tableDavid Young
 
Introduction to elements & periodic table
Introduction to elements & periodic tableIntroduction to elements & periodic table
Introduction to elements & periodic tableDavid Young
 
Physics ii djy 2013 ppt wave characteristics
Physics ii djy 2013 ppt    wave characteristicsPhysics ii djy 2013 ppt    wave characteristics
Physics ii djy 2013 ppt wave characteristicsDavid Young
 
Topic 20 6 stereoisomers
Topic 20 6   stereoisomersTopic 20 6   stereoisomers
Topic 20 6 stereoisomersDavid Young
 

Mehr von David Young (20)

1.4 acceleration
1.4   acceleration1.4   acceleration
1.4 acceleration
 
1.3 velocity
1.3   velocity1.3   velocity
1.3 velocity
 
1.2 displacement and position vs time graphs
1.2   displacement and position vs time graphs1.2   displacement and position vs time graphs
1.2 displacement and position vs time graphs
 
1.1 vectors
1.1   vectors1.1   vectors
1.1 vectors
 
2016 topic 5.2 hess's law
2016   topic 5.2  hess's law2016   topic 5.2  hess's law
2016 topic 5.2 hess's law
 
2016 topic 5.1 measuring energy changes
2016   topic 5.1 measuring energy changes2016   topic 5.1 measuring energy changes
2016 topic 5.1 measuring energy changes
 
2016 topic 4.5 bonding - metallic
2016   topic 4.5 bonding - metallic2016   topic 4.5 bonding - metallic
2016 topic 4.5 bonding - metallic
 
2016 topic 4.1 bonding - ionic
2016   topic 4.1 bonding - ionic2016   topic 4.1 bonding - ionic
2016 topic 4.1 bonding - ionic
 
2016 topic 4.2 bonding - covalent
2016   topic 4.2  bonding - covalent2016   topic 4.2  bonding - covalent
2016 topic 4.2 bonding - covalent
 
Unit 4 2014 ppt sound
Unit 4 2014  ppt    soundUnit 4 2014  ppt    sound
Unit 4 2014 ppt sound
 
Unit 4 2014 ppt wave characteristics
Unit 4 2014  ppt    wave characteristicsUnit 4 2014  ppt    wave characteristics
Unit 4 2014 ppt wave characteristics
 
2016 topic 01 part 1
2016 topic 01   part 12016 topic 01   part 1
2016 topic 01 part 1
 
Chemistry 1 - Atomic Structure
Chemistry 1 - Atomic StructureChemistry 1 - Atomic Structure
Chemistry 1 - Atomic Structure
 
2016 Topic 2: Electron Configuration
2016  Topic 2: Electron Configuration2016  Topic 2: Electron Configuration
2016 Topic 2: Electron Configuration
 
2016 Topic 2: Atomic Structure
2016 Topic 2: Atomic Structure2016 Topic 2: Atomic Structure
2016 Topic 2: Atomic Structure
 
2016 topic 0 - oxidation and reduction (INTRODUCTION)
2016   topic 0 - oxidation and reduction (INTRODUCTION)2016   topic 0 - oxidation and reduction (INTRODUCTION)
2016 topic 0 - oxidation and reduction (INTRODUCTION)
 
2016 topic 0 - elements & periodic table
2016   topic 0 - elements & periodic table2016   topic 0 - elements & periodic table
2016 topic 0 - elements & periodic table
 
Introduction to elements & periodic table
Introduction to elements & periodic tableIntroduction to elements & periodic table
Introduction to elements & periodic table
 
Physics ii djy 2013 ppt wave characteristics
Physics ii djy 2013 ppt    wave characteristicsPhysics ii djy 2013 ppt    wave characteristics
Physics ii djy 2013 ppt wave characteristics
 
Topic 20 6 stereoisomers
Topic 20 6   stereoisomersTopic 20 6   stereoisomers
Topic 20 6 stereoisomers
 

Programming with sensors bumper switch 1

  • 1. VEX Robotics I Power Points Topic 09 Programming Design Basics Bumper Switch Sensing 1 www.pedagogics.ca
  • 2. Topics Covered in this Presentation Topic 09 • Introduction to the bumper switch • flowcharting and writing pseudocode •program sketch #1 • while loops and Boolean logic • if else loops and sensor input
  • 3. Bumper Switch (digital sensor) Usually positioned on front of robot. Output is either a 1 (depressed) or a 0 0
  • 4. Bumper Switch (digital sensor) Usually positioned on front of robot. Output is either a 1 (depressed) or a 0 1
  • 5. Bumper Switch (digital sensor) Usually positioned on front of robot. Output is either a 1 (depressed) or a 0 0
  • 6. Bumper Switch (digital sensor) Usually positioned on front of robot. Output is either a 1 (depressed) or a 0 1
  • 7. Program sketch #1 Write a simple program to make your robot drive forward indefinitely , but will stop, turn 180o and continue driving if the robot encounters an obstacle. STEP 1 – FLOWCHART • thinking about how ROBOTC works STEP 2 – PSEUDOCODE STEP 3 – ACTUAL CODE
  • 9. START Flow chart describes behavior sequence. DRIVE FORWARD This flowchart gives us the basic NO idea of what behaviors we want to Switch pressed see in our robot. ? YES The flowchart however is overly simplified and needs a few extras to Stop, reverse, 180 degree turn make it easily transferable to code.
  • 10. Cannot use a wait statement because we want START the robot to perform two functions alternately (essentially simultaneously) IF Always Switch TRUE WHILE DRIVE not LOOP ? infinite pressed FORWARD Move on loop ? FALSE END Stop, reverse, 180 degree turn
  • 11. DECISIONS must This type of question is called a Boolean be thought of as statement. questions that can be answered The answer is called a “truth value” and YES or NO the answer is only valid at the time the TRUE or FALSE question is asked. You used a Boolean statement in the remote control coding for Tumbler
  • 13. START Pseudo code - basic commands, comments about functions and behaviors This code will never compile Forms the backbone of your program and translates from the flowchart to ROBOTC
  • 14.
  • 15. IF , ELSE boolean statement used to check bumper switch. If switch is not pressed, robot START drives forward IF Always Switch TRUE WHILE DRIVE not LOOP ? infinite pressed FORWARD loop ?
  • 16.
  • 17. IF , ELSE boolean statement used to check START bumper switch. If switch is not pressed, robot drives forward IF Always Switch TRUE WHILE DRIVE not LOOP ? infinite pressed FORWARD loop ?
  • 18.
  • 19. If switch is pressed – ELSE – the stop and turn START behavior occurs, then robot returns to moving forward (unless what is happening?) IF Always Switch TRUE WHILE DRIVE not LOOP ? infinite pressed FORWARD loop ? FALSE Stop, reverse, 180 degree turn
  • 20.
  • 21. START IF Always Switch TRUE WHILE DRIVE not LOOP ? infinite pressed FORWARD Move on loop ? FALSE END Stop, reverse, 180 degree turn