SlideShare une entreprise Scribd logo
1  sur  6
VEX Robotics I Power Points
                             Topic 09
                    Programming Design Basics
                     Bumper Switch Sensing 2
www.pedagogics.ca
Program sketch 2 – have your robot run through
             START        the subroutine for 60 s and then stop.

                          Where do we make the changes?

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

                                            FALSE

                                 Stop, reverse, 180
       END                          degree turn
Program sketch 2 – have your robot run through
               START        the subroutine for 60 s and then stop.



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

 STOP MOTORS                                FALSE

                                 Stop, reverse, 180
        END                         degree turn
WHILE loops can
 run for certain
periods of time
by using built in
     timers
The CORTEX has 4 built in timers called
                    T1, T2, T3 and T4
WHILE loops can
 run for certain    These timers all run automatically while
periods of time     the CORTEX is on.
by using built in
     timers         To reset a timer to zero the ClearTimer
                    command is used. For timer T1




                    The Time1 command retrieves the value
                    of a timer in milliseconds
Change your code and test your robot

Contenu connexe

Plus de 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
 

Plus de 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
 

Programming with sensors bumper switch 2

  • 1. VEX Robotics I Power Points Topic 09 Programming Design Basics Bumper Switch Sensing 2 www.pedagogics.ca
  • 2. Program sketch 2 – have your robot run through START the subroutine for 60 s and then stop. Where do we make the changes? IF Move Always Switch TRUE on WHILE not DRIVE LOOP ? infinite pressed FORWARD loop ? FALSE Stop, reverse, 180 END degree turn
  • 3. Program sketch 2 – have your robot run through START the subroutine for 60 s and then stop. IF TRUE Switch TRUE WHILE DRIVE FALSE not t < 60 s pressed FORWARD ? STOP MOTORS FALSE Stop, reverse, 180 END degree turn
  • 4. WHILE loops can run for certain periods of time by using built in timers
  • 5. The CORTEX has 4 built in timers called T1, T2, T3 and T4 WHILE loops can run for certain These timers all run automatically while periods of time the CORTEX is on. by using built in timers To reset a timer to zero the ClearTimer command is used. For timer T1 The Time1 command retrieves the value of a timer in milliseconds
  • 6. Change your code and test your robot