Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma config(Sensor, dgtl7, btn, sensorTouch)
- #pragma config(Motor, port2, rightMotor, tmotorServoContinuousRotation, openLoop)
- #pragma config(Motor, port3, leftMotor, tmotorServoContinuousRotation, openLoop)
- #pragma config(Motor, port4, arm, tmotorVex269_MC29, openLoop, reversed)
- //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
- /*----------------------------------------------------------------------------------------------------*\
- |* - Dual Joystick Control with Arm - 1 Remote - *|
- |* ROBOTC on VEX 2.0 Cortex *|
- |* *|
- |* This program uses both the Left and the Right joysticks to run the robot using "tank control". *|
- |* The Group 6 buttons on the top-right of the VEXnet Joystick are used to raise and lower an arm. *|
- |* *|
- |* ROBOT CONFIGURATION *|
- |* NOTES: *|
- |* 1) Ch1 is the X axis and Ch2 is the Y axis for the RIGHT joystick. *|
- |* 2) Ch3 is the Y axis and Ch4 is the X axis for the LEFT joystick. *|
- |* *|
- |* MOTORS & SENSORS: *|
- |* [I/O Port] [Name] [Type] [Description] *|
- |* Motor - Port 2 rightMotor VEX Motor Right motor *|
- |* Motor - Port 3 leftMotor VEX Motor Left motor *|
- |* Motor - Port 6 armMotor VEX Motor Arm motor *|
- \*----------------------------------------------------------------------------------------------------*/
- //+++++++++++++++++++++++++++++++++++++++++++++| MAIN |+++++++++++++++++++++++++++++++++++++++++++++++
- task main()
- {
- while(1 == 1)
- {
- //Driving Motor Control
- motor[leftMotor] = vexRT[Ch3] / 2;
- motor[rightMotor] = vexRT[Ch2] / 2;
- //Arm Control
- if(vexRT[Btn6U] == 1)
- {
- motor[arm] = 40;
- }
- else if(vexRT[Btn6D] == 1)
- {
- motor[arm] = -40;
- }
- else
- {
- motor[arm] = 0;
- }
- if(SensorValue[btn] == 1)
- {
- motor[rightMotor] = 50;
- motor[leftMotor] = 50;
- wait1Msec(750);
- motor[arm] = -30;
- wait1Msec(900);
- motor[arm] = 30;
- wait1Msec(900);
- motor[rightMotor] = -50;
- motor[leftMotor] = -50;
- wait(750);
- motor[rightMotor] = 50;
- motor[leftMotor] = -50;
- wait(575);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement