Advertisement
Guest User

Untitled

a guest
May 31st, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. #pragma config(Sensor, dgtl7, btn, sensorTouch)
  2. #pragma config(Motor, port2, rightMotor, tmotorServoContinuousRotation, openLoop)
  3. #pragma config(Motor, port3, leftMotor, tmotorServoContinuousRotation, openLoop)
  4. #pragma config(Motor, port4, arm, tmotorVex269_MC29, openLoop, reversed)
  5. //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
  6.  
  7. /*----------------------------------------------------------------------------------------------------*\
  8. |* - Dual Joystick Control with Arm - 1 Remote - *|
  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. |* The Group 6 buttons on the top-right of the VEXnet Joystick are used to raise and lower an arm. *|
  13. |* *|
  14. |* ROBOT CONFIGURATION *|
  15. |* NOTES: *|
  16. |* 1) Ch1 is the X axis and Ch2 is the Y axis for the RIGHT joystick. *|
  17. |* 2) Ch3 is the Y axis and Ch4 is the X axis for the LEFT joystick. *|
  18. |* *|
  19. |* MOTORS & SENSORS: *|
  20. |* [I/O Port] [Name] [Type] [Description] *|
  21. |* Motor - Port 2 rightMotor VEX Motor Right motor *|
  22. |* Motor - Port 3 leftMotor VEX Motor Left motor *|
  23. |* Motor - Port 6 armMotor VEX Motor Arm motor *|
  24. \*----------------------------------------------------------------------------------------------------*/
  25.  
  26. //+++++++++++++++++++++++++++++++++++++++++++++| MAIN |+++++++++++++++++++++++++++++++++++++++++++++++
  27.  
  28. task main()
  29. {
  30. while(1 == 1)
  31. {
  32. //Driving Motor Control
  33. motor[leftMotor] = vexRT[Ch3] / 2;
  34. motor[rightMotor] = vexRT[Ch2] / 2;
  35.  
  36. //Arm Control
  37. if(vexRT[Btn6U] == 1)
  38. {
  39. motor[arm] = 40;
  40. }
  41. else if(vexRT[Btn6D] == 1)
  42. {
  43. motor[arm] = -40;
  44. }
  45. else
  46. {
  47. motor[arm] = 0;
  48. }
  49.  
  50.  
  51. if(SensorValue[btn] == 1)
  52. {
  53. motor[rightMotor] = 50;
  54. motor[leftMotor] = 50;
  55. wait1Msec(750);
  56. motor[arm] = -30;
  57. wait1Msec(900);
  58. motor[arm] = 30;
  59. wait1Msec(900);
  60. motor[rightMotor] = -50;
  61. motor[leftMotor] = -50;
  62. wait(750);
  63. motor[rightMotor] = 50;
  64. motor[leftMotor] = -50;
  65. wait(575);
  66.  
  67. }
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement