Beispiel #1
0
void liftAction(void *param) {
  int iterations = 0;
  while (!isLiftReady() && (iterations++ < (liftBreakout / 10))) {
    setLiftSpeed(pLoopDetermineLiftSpeed());
    delay(10);
  }
  liftDone = true;
}
//Dual mirrored remotes; 5u = up, 6d = down, 7u/7l = left up/up, 7r/7d = right up/down
void lift() {
  if ((vexRT[Btn5U] == 1) /*|| (vexRT[Btn5UXmtr2] == 1)*/) {
    setLiftSpeed(FULL);
  }
  else if ((vexRT[Btn5D] == 1) /*|| (vexRT[Btn5DXmtr2] == 1)*/) {
    setLiftSpeed(-FULL);
  }
  else if ((vexRT[Btn7U] == 1) /*|| (vexRT[Btn7UXmtr2] == 1)*/) {
    setLiftLSpeed(FULL);
  }
  else if ((vexRT[Btn7L] == 1) /*|| (vexRT[Btn7LXmtr2] == 1)*/) {
    setLiftLSpeed(-FULL);
  }
  else if ((vexRT[Btn7R] == 1) /*|| (vexRT[Btn7RXmtr2] == 1)*/ ) {
    setLiftRSpeed(FULL);
  }
  else if ((vexRT[Btn7D] == 1) /*|| (vexRT[Btn7DXmtr2] == 1)*/) {
    setLiftRSpeed(-FULL);
  }
  else {
    killLift();
  }
}
task usercontrol()
{
	// User control code here, inside the loop

	while (true)
	{
		bool tankdrive = false; //enable tankdrive???

		while (tankdrive==false)
		{
			int DriveX = -vexRT[Ch4];
			int DriveY = vexRT[Ch3];
			int liftSpeed = vexRT[Ch2];

				if (abs(DriveY) < 5) DriveY = 0; // Deadband
				if (abs(DriveX) < 5) DriveX = 0; // Deadband
				if (abs(liftSpeed) < 5) liftSpeed = 5; //Deadband and Keep String Taught

			driveArcade(DriveY, DriveX);
			setLiftSpeed(liftSpeed);
	}
		while (tankdrive==true) //Tank Drive Option For Debugging DriveTrain
	{
			motor[leftRear] = motor[leftFront] = vexRT[Ch3];
			motor[rightRear] = motor[rightFront] = vexRT[Ch2];

		}

		// This is the main execution loop for the user control program. Each time through the loop
		// your program should update motor + servo values based on feedback from the joysticks.

		// .....................................................................................
		// Insert user code here. This is where you use the joystick values to update your motors, etc.
		// .....................................................................................


}
}