Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma config(Sensor, dgtl4, bttn, sensorTouch)
- #pragma config(Motor, port3, leftMotor, tmotorVex393_MC29, openLoop)
- #pragma config(Motor, port5, rightMotor, tmotorVex393_MC29, openLoop)
- #pragma config(Motor, port8, armMotor, tmotorVex393_MC29, openLoop)
- //+++++++++++++++++++++++++++++++++++++++++++++| 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[armMotor] = 40;
- }
- else if(vexRT[Btn6D] == 1)
- {
- motor[armMotor] = -40;
- }
- else
- {
- motor[armMotor] = 0;
- }
- if (SensorValue [bttn] == 1)
- {
- motor[leftMotor] = 40; // Start of run 1
- motor[rightMotor] = 55;
- wait1Msec(3000);
- motor[leftMotor] = 0;
- motor[rightMotor] = 0;
- motor[armMotor] = -40;
- wait1Msec(500);
- motor[armMotor] = 0;
- wait1Msec(1000);
- motor[armMotor] = 40;
- wait1Msec(300);
- motor[armMotor] = 0;
- motor[leftMotor] = -40;
- motor[rightMotor] = -40;
- wait1Msec (3000);
- motor[leftMotor] = 0;
- motor[rightMotor] = 0;
- wait1Msec (3000); // End of run 1
- motor[rightMotor] = 40;
- wait1Msec (500);
- motor[rightMotor] = 0;
- wait1Msec (1000);
- motor[leftMotor] = 40; // Start of run 2
- motor[rightMotor] = 55;
- wait1Msec(3000);
- motor[leftMotor] = 0;
- motor[rightMotor] = 0;
- motor[armMotor] = -40;
- wait1Msec(500);
- motor[armMotor] = 0;
- wait1Msec(1000);
- motor[armMotor] = 40;
- wait1Msec(300);
- motor[armMotor] = 0;
- motor[leftMotor] = -40;
- motor[rightMotor] = -40;
- wait1Msec (3000);
- motor[leftMotor] = 0;
- motor[rightMotor] = 0; // End of run 2
- }
- }
- }
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement