Advertisement
Guest User

Untitled

a guest
May 26th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. #pragma config(Sensor, dgtl1, Touch, sensorTouch)
  2. #pragma config(Motor, port2, rightMotor, tmotorVex393_MC29, openLoop)
  3. #pragma config(Motor, port3, leftMotor, tmotorVex393_MC29, openLoop, reversed)
  4. #pragma config(Motor, port4, armMotor, tmotorVex393_MC29, openLoop)
  5. //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
  6.  
  7. /*----------------------------------------------------------------------------------------------------*\
  8. |* - Dual Joystick Control - *|
  9. |* ROBOTC on VEX 2.0 Cortex *|
  10. |* *|
  11. |* This program uses both the Left and the Right joysticks to run the robot using "tank control". *|
  12. |* *|
  13. |* ROBOT CONFIGURATION *|
  14. |* NOTES: *|
  15. |* 1) Ch1 is the X axis and Ch2 is the Y axis for the RIGHT joystick. *|
  16. |* 2) Ch3 is the Y axis and Ch4 is the X axis for the LEFT joystick. *|
  17. |* *|
  18. |* MOTORS & SENSORS: *|
  19. |* [I/O Port] [Name] [Type] [Description] *|
  20. |* Motor - Port 2 rightMotor VEX Motor Right motor *|
  21. |* Motor - Port 3 leftMotor VEX Motor Left motor *|
  22. \*----------------------------------------------------------------------------------------------------*/
  23.  
  24. //+++++++++++++++++++++++++++++++++++++++++++++| MAIN |+++++++++++++++++++++++++++++++++++++++++++++++
  25. task main ()
  26. {
  27.  
  28. while(1 == 1)
  29. {
  30. motor[leftMotor] = vexRT[Ch3]; // Left Joystick Y value
  31. motor[rightMotor] = vexRT[Ch2]; // Right Joystick Y value
  32.  
  33. if (vexRT [Btn6U] == 1)
  34. {
  35. motor [armMotor] = 60;
  36. }
  37.  
  38. else
  39. {
  40. if (vexRT [Btn6D] == 1)
  41. {
  42. motor [armMotor] = -60;
  43. }
  44. else
  45. {
  46. motor [armMotor] = 0;
  47.  
  48. if (SensorValue (Touch) ==1)
  49. {
  50.  
  51. motor [rightMotor] = 0;
  52. motor [leftMotor] = 0;
  53. motor [armMotor] = 0;
  54. wait1Msec (2000);
  55.  
  56. motor [armMotor] = 50;
  57. wait1Msec (250);
  58.  
  59. motor [rightMotor] = 50;
  60. motor [leftMotor] = 50;
  61. motor [armMotor] = 0;
  62. wait1Msec (2500);
  63.  
  64. motor [rightMotor] = 0;
  65. motor [leftMotor] = 0;
  66. motor [armMotor]= -60;
  67. wait1Msec (350);
  68.  
  69. motor [armMotor]= 0;
  70. wait1Msec (3000);
  71.  
  72. motor [armMotor] = 90;
  73. motor [rightMotor] = 0;
  74. motor [leftMotor] = 0;
  75. wait1Msec (700);
  76.  
  77. motor [rightMotor] =-90;
  78. motor [leftMotor] =-90;
  79. motor [armMotor] =0;
  80. wait1Msec (2100);
  81.  
  82. motor [armMotor] =0;
  83. motor [rightMotor] =0;
  84. motor [leftMotor] =0;
  85. wait1Msec (1970);
  86.  
  87. motor [armMotor] =0;
  88. motor [rightMotor] =90;
  89. motor [leftMotor] =0;
  90. wait1Msec (1000);
  91.  
  92. motor [rightMotor] =90;
  93. motor [leftMotor] =90;
  94. wait1Msec (450);
  95.  
  96. motor [rightMotor] =0;
  97. motor [leftMotor] =0;
  98. motor [armMotor] = -70;
  99. wait1Msec (600);
  100.  
  101. motor [armMotor] =0;
  102. motor [rightMotor] = 0;
  103. motor [leftMotor] = 0;
  104. wait1Msec (3000);
  105.  
  106. motor [armMotor] = 60;
  107. motor [rightMotor] =0;
  108. motor [leftMotor] = 0;
  109. wait1Msec (700);
  110.  
  111. motor [armMotor] =0;
  112. motor [rightMotor] =-90;
  113. motor [leftMotor] = -90;
  114. wait1Msec (800);
  115. }
  116.  
  117. }
  118. }
  119. }
  120. }
  121. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement