SlideShare a Scribd company logo
1 of 7
VEX Robotics I Power Points
                             Topic 09
                    Programming Design Basics
                     Bumper Switch Sensing 3
www.pedagogics.ca
Program sketch 3 – have your robot run through
                            the subroutine and stop after it makes 5
               START        contacts with the wall

                            What needs to change?

                                         IF
                          TRUE        Switch          TRUE
               WHILE                                           DRIVE
FALSE                                   not
               t < 60 s
                                      pressed                FORWARD
                                         ?

 STOP MOTORS                                FALSE

                                 Stop, reverse, 180
        END                         degree turn
Program sketch 3 – have your robot run through
                          the subroutine and stop after it makes 5
               START      contacts with the wall



                                       IF
               WHILE                                TRUE
               sensor
                        TRUE        Switch
                                                             DRIVE
FALSE                                 not
               count
                                    pressed                FORWARD
                 <5
                                       ?

 STOP MOTORS                              FALSE

                               Stop, reverse, 180
        END                       degree turn
WHILE loops can
run for a certain
number of cycles
    by using
   variables
WHILE loops can
    run for a certain
                                Using Variables
    number of cycles
        by using
                                Any term (except for reserved words) can
       variables
                                be used as a variable in ROBOTC




An integer variable is used to keep track of a number of events etc.



Each time the bumper is activated, we want the counter to increase by 1
Program sketch 3 – have your robot run through
                          the subroutine and stop after it makes 5
               START      contacts with the wall

                          What needs to change?

                                       IF
               WHILE                                TRUE
               sensor
                        TRUE        Switch
                                                                 DRIVE
FALSE                                 not
               count
                                    pressed                    FORWARD
                 <5
                                       ?

 STOP MOTORS                              FALSE

                               Stop, reverse, 180
                                                           Counter + 1
        END                       degree turn
Change your code and test your robot

Report to your teacher for your individual programming challenge

More Related Content

More from David 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
 
Topic 20 4 condensation reactions
Topic 20 4    condensation reactionsTopic 20 4    condensation reactions
Topic 20 4 condensation reactionsDavid Young
 
Topic 20 3 elimination reactions
Topic 20 3    elimination reactionsTopic 20 3    elimination reactions
Topic 20 3 elimination reactionsDavid Young
 
Topic 20 2 substitution reactions
Topic 20 2    substitution reactionsTopic 20 2    substitution reactions
Topic 20 2 substitution reactionsDavid Young
 
Topic 10 & 20 reaction summary and review
Topic 10 & 20    reaction summary and reviewTopic 10 & 20    reaction summary and review
Topic 10 & 20 reaction summary and reviewDavid Young
 

More from David Young (20)

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
 
Topic 20 4 condensation reactions
Topic 20 4    condensation reactionsTopic 20 4    condensation reactions
Topic 20 4 condensation reactions
 
Topic 20 3 elimination reactions
Topic 20 3    elimination reactionsTopic 20 3    elimination reactions
Topic 20 3 elimination reactions
 
Topic 20 2 substitution reactions
Topic 20 2    substitution reactionsTopic 20 2    substitution reactions
Topic 20 2 substitution reactions
 
Topic 10 & 20 reaction summary and review
Topic 10 & 20    reaction summary and reviewTopic 10 & 20    reaction summary and review
Topic 10 & 20 reaction summary and review
 

VEX Robotics I Power Points Bumper Switch Sensing 3

  • 1. VEX Robotics I Power Points Topic 09 Programming Design Basics Bumper Switch Sensing 3 www.pedagogics.ca
  • 2. Program sketch 3 – have your robot run through the subroutine and stop after it makes 5 START contacts with the wall What needs to change? IF TRUE Switch TRUE WHILE DRIVE FALSE not t < 60 s pressed FORWARD ? STOP MOTORS FALSE Stop, reverse, 180 END degree turn
  • 3. Program sketch 3 – have your robot run through the subroutine and stop after it makes 5 START contacts with the wall IF WHILE TRUE sensor TRUE Switch DRIVE FALSE not count pressed FORWARD <5 ? STOP MOTORS FALSE Stop, reverse, 180 END degree turn
  • 4. WHILE loops can run for a certain number of cycles by using variables
  • 5. WHILE loops can run for a certain Using Variables number of cycles by using Any term (except for reserved words) can variables be used as a variable in ROBOTC An integer variable is used to keep track of a number of events etc. Each time the bumper is activated, we want the counter to increase by 1
  • 6. Program sketch 3 – have your robot run through the subroutine and stop after it makes 5 START contacts with the wall What needs to change? IF WHILE TRUE sensor TRUE Switch DRIVE FALSE not count pressed FORWARD <5 ? STOP MOTORS FALSE Stop, reverse, 180 Counter + 1 END degree turn
  • 7. Change your code and test your robot Report to your teacher for your individual programming challenge