void setIntake() // reads the Joystick, determines the state of the intake and sends values to motors - used in driver control { if(vexRT[Btn6U] == 1) // if button 6 Up is pressed... {intakeIn();} // ...intake balls. else if(vexRT[Btn6D] == 1) // if button 6 Down is pressed... {intakeOut();} // ...outtake balls (possibly at reduced speed). else // if neither button is pressed... {intakeStop();} // ...stop the motors. }
task main() { init(); wait1Msec(1000); sticksDown(); raiseLift(100); time1[T1]=0; while (nMotorEncoder[intake] < 430 && time1[T1] < 2500) //while the encoder wheel turns one revolution { times = time1[T1]; } allStop(); wait1Msec(500); //if(time1[T1]>2500) // while(true){ // nxtDisplayCenteredBigTextLine(1,":("); // } releaseBalls(); allStop(); wait1Msec(3000); retainBalls(); allStop(); wait1Msec(750); lowerLift(20); while (nMotorEncoder[intake] > 220) //while the encoder wheel turns one revolution { } allStop(); wait1Msec(500); releaseAutoBall(); intakeIn(100); wait1Msec(600); allStop(); wait1Msec(500); sticksUp(); wait1Msec(3000); while(SensorValue[sonarSensor]>25){allStop();} wait1Msec(2000); sticksDown(); allStop(); wait1Msec(500); raiseLift(100); while (nMotorEncoder[intake] < 1000) //while the encoder wheel turns one revolution { } allStop(); wait1Msec(500); releaseBalls(); allStop(); wait1Msec(3000); retainBalls(); allStop(); wait1Msec(750); lowerLift(20); while (nMotorEncoder[intake] > 740) //while the encoder wheel turns one revolution { } allStop(); wait1Msec(500); }