Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. #pragma config(Motor, port1, claw, tmotorVex393_HBridge, openLoop)
  2. #pragma config(Motor, port2, chain, tmotorVex393_MC29, openLoop)
  3. #pragma config(Motor, port3, scissor1, tmotorVex393_MC29, openLoop)
  4. #pragma config(Motor, port4, scissor2, tmotorVex393_MC29, openLoop)
  5. #pragma config(Motor, port5, scissor3, tmotorVex393_MC29, openLoop)
  6. #pragma config(Motor, port6, scissor4, tmotorVex393_MC29, openLoop)
  7. #pragma config(Motor, port7, mobilebase, tmotorVex393_MC29, openLoop)
  8. #pragma config(Motor, port8, backleft, tmotorVex393_MC29, openLoop)
  9. #pragma config(Motor, port9, backright, tmotorVex393_MC29, openLoop)
  10. //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
  11.  
  12. #pragma platform(VEX)
  13. #pragma competitionControl(Competition)
  14. #pragma autonomousDuration(15)
  15. #pragma userControlDuration(120)
  16.  
  17. #include "Vex_Competition_Includes.c"
  18.  
  19. void scissor(int speed)
  20. {
  21. motor[scissor1] = speed;
  22. motor[scissor2] = speed;
  23. motor[scissor3] = speed;
  24. motor[scissor4] = speed;
  25. }
  26.  
  27. void chainbar(int speed)
  28. {
  29. motor[chain] = speed;
  30. }
  31.  
  32. void grab(int speed)
  33. {
  34. motor[claw] = speed;
  35. }
  36. void base(int speed)
  37. {
  38. motor[mobilebase] = speed;
  39. }
  40.  
  41.  
  42. void move(int speed)
  43. {
  44. motor[backleft] = speed;
  45. motor[backright] = speed;
  46. }
  47.  
  48. void pre_auton()
  49. {
  50. bStopTasksBetweenModes = true;
  51. }
  52.  
  53. task autonomous()
  54. {
  55.  
  56. }
  57.  
  58. task usercontrol()
  59.  
  60. {
  61. // weird controls that should probably be changed
  62. int X2 = 0, Y1 = 0, X1 = 0, threshold = 15;
  63. int scissorval = 0;
  64. int chainbarval = 0;
  65. int grabval = 0;
  66. int baseval = 0;
  67. while(1)
  68. {
  69. if(abs(vexRT[Ch3]) > threshold) Y1 = vexRT[Ch3];
  70. else Y1 = 0;
  71. if(abs(vexRT[Ch4]) > threshold) X1 = vexRT[Ch4];
  72. else X1 = 0;
  73. // if(abs(vexRT[Ch1]) > threshold) X2 = vexRT[Ch1];
  74. // else X2 = 0;
  75.  
  76. motor[backright] = Y1 - X2 + X1;
  77. motor[backleft] = -Y1 - X2 + X1;
  78.  
  79. // if (abs(vexRT[Ch3Xmtr2]) > threshold) scissorval = vexRT[Ch3Xmtr2];
  80. // else scissorval = 0;
  81. // scissor(scissorval);
  82.  
  83. // if (abs(vexRT[Ch1Xmtr2]) > threshold) grabval = vexRT[Ch1Xmtr2];
  84. // else grabval = 0;
  85. // grab(grabval);
  86.  
  87. // - - - - - - - - scissor stuff - - - - - - - -
  88. if ((vexRT[Btn5U]) == true) scissorval = 127;
  89. else scissorval = 0;
  90. if ((vexRT[Btn5D]) == true) scissorval = -127;
  91. else scissorval = 0;
  92.  
  93. motor[scissor1] = scissorval;
  94. motor[scissor2] = scissorval;
  95. motor[scissor3] = scissorval;
  96. motor[scissor4] = scissorval;
  97. // - - - - - - - - chainbar stuff - - - - - - -
  98. if ((vexRT[Btn6U]) == true) chainbarval = 127;
  99. else chainbarval = 0;
  100. if ((vexRT[Btn6D]) == true) chainbarval = -127;
  101. else chainbarval = 0;
  102.  
  103. motor[chain] = chainbarval;
  104.  
  105. // - - - - - - - - claw stuff - - - - - - - - -
  106. if ((vexRT[Btn7D]) == true) grabval = 127;
  107. else grabval = 0;
  108. if ((vexRT[Btn7U]) == true) grabval = -127;
  109. else grabval = 0;
  110.  
  111. motor[claw] = grabval;
  112.  
  113. // - - - - - - - - base lifty stuff - - - - - -
  114. if ((vexRT[Btn7L]) == true) baseval = 127;
  115. else baseval = 0;
  116. if ((vexRT[Btn7R]) == true) baseval = -127;
  117. else baseval = 0;
  118.  
  119. motor[mobilebase] = baseval;
  120.  
  121. }
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement