Advertisement
Guest User

Untitled

a guest
Jan 7th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Robots 4.40 KB | None | 0 0
  1. /*---------------------------------------------------------------------------*/
  2. /*                                                                           */
  3. /*        Description: Competition template for VEX EDR                      */
  4. /*                                                                           */
  5. /*---------------------------------------------------------------------------*/
  6.  
  7. // This code is for the VEX cortex platform
  8. #pragma platform(VEX2)
  9.  
  10. // Select Download method as "competition"
  11. #pragma competitionControl(Competition)
  12.  
  13. //Main competition background code...do not modify!
  14. #include "Vex_Competition_Includes.c"
  15.  
  16. /*---------------------------------------------------------------------------*/
  17. /*                          Pre-Autonomous Functions                         */
  18. /*                                                                           */
  19. /*  You may want to perform some actions before the competition starts.      */
  20. /*  Do them in the following function.  You must return from this function   */
  21. /*  or the autonomous and usercontrol tasks will not be started.  This       */
  22. /*  function is only called once after the cortex has been powered on and    */
  23. /*  not every time that the robot is disabled.                               */
  24. /*---------------------------------------------------------------------------*/
  25.  
  26. void pre_auton()
  27. {
  28.   // Set bStopTasksBetweenModes to false if you want to keep user created tasks
  29.   // running between Autonomous and Driver controlled modes. You will need to
  30.   // manage all user created tasks if set to false.
  31.   bStopTasksBetweenModes = true;
  32.  
  33.     // Set bDisplayCompetitionStatusOnLcd to false if you don't want the LCD
  34.     // used by the competition include file, for example, you might want
  35.     // to display your team name on the LCD in this function.
  36.     // bDisplayCompetitionStatusOnLcd = false;
  37.  
  38.   // All activities that occur before the competition starts
  39.   // Example: clearing encoders, setting servo positions, ...
  40. }
  41.  
  42. /*---------------------------------------------------------------------------*/
  43. /*                                                                           */
  44. /*                              Autonomous Task                              */
  45. /*                                                                           */
  46. /*  This task is used to control your robot during the autonomous phase of   */
  47. /*  a VEX Competition.                                                       */
  48. /*                                                                           */
  49. /*  You must modify the code to add your own robot specific commands here.   */
  50. /*---------------------------------------------------------------------------*/
  51.  
  52. task autonomous()
  53. {
  54.   // ..........................................................................
  55.   // Insert user code here.
  56.   // ..........................................................................
  57.  
  58.   // Remove this function call once you have "real" code.
  59.   AutonomousCodePlaceholderForTesting();
  60. }
  61.  
  62. /*---------------------------------------------------------------------------*/
  63. /*                                                                           */
  64. /*                              User Control Task                            */
  65. /*                                                                           */
  66. /*  This task is used to control your robot during the user control phase of */
  67. /*  a VEX Competition.                                                       */
  68. /*                                                                           */
  69. /*  You must modify the code to add your own robot specific commands here.   */
  70. /*---------------------------------------------------------------------------*/
  71.  
  72. task usercontrol()
  73. {
  74.   // User control code here, inside the loop
  75.  
  76.   while (true)
  77.   {
  78.     // This is the main execution loop for the user control program.
  79.     // Each time through the loop your program should update motor + servo
  80.     // values based on feedback from the joysticks.
  81.  
  82.     // ........................................................................
  83.     // Insert user code here. This is where you use the joystick values to
  84.     // update your motors, etc.
  85.     // ........................................................................
  86.  
  87.     // Remove this function call once you have "real" code.
  88.     UserControlCodePlaceholderForTesting();
  89.   }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement