VEX Robotics I Power Points                             Topic 09                    Programming Design Basics             ...
Program sketch 3 – have your robot run through                            the subroutine and stop after it makes 5        ...
Program sketch 3 – have your robot run through                          the subroutine and stop after it makes 5          ...
WHILE loops canrun for a certainnumber of cycles    by using   variables
WHILE loops can    run for a certain                                Using Variables    number of cycles        by using   ...
Program sketch 3 – have your robot run through                          the subroutine and stop after it makes 5          ...
Change your code and test your robotReport to your teacher for your individual programming challenge
Upcoming SlideShare
Loading in …5
×

Programming with sensors bumper switch 3

3,959 views
4,045 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,959
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Programming with sensors bumper switch 3

  1. 1. VEX Robotics I Power Points Topic 09 Programming Design Basics Bumper Switch Sensing 3www.pedagogics.ca
  2. 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 DRIVEFALSE not t < 60 s pressed FORWARD ? STOP MOTORS FALSE Stop, reverse, 180 END degree turn
  3. 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 DRIVEFALSE not count pressed FORWARD <5 ? STOP MOTORS FALSE Stop, reverse, 180 END degree turn
  4. 4. WHILE loops canrun for a certainnumber of cycles by using variables
  5. 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 ROBOTCAn 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. 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 DRIVEFALSE not count pressed FORWARD <5 ? STOP MOTORS FALSE Stop, reverse, 180 Counter + 1 END degree turn
  7. 7. Change your code and test your robotReport to your teacher for your individual programming challenge

×