task raiseLiftWhile(){ raiseLift(100); time1[T1]=0; while (nMotorEncoder[intake] < 415 && time1[T1] < 2800) //while the encoder wheel turns one revolution { times = time1[T1]; } allStop(); wait1Msec(500); if(time1[T1]>2500) StopAllTasks(); }
task main() { servoPrep(); Joystick_WaitForStart(); disableDiagnosticsDisplay(); while(true) { encoderPrep(); startTrackers(); driveForward(310.0); turnRight(85.0); if(irDetected == true) { irPos2 = true; turnRight(40.0); irDetected = false; driveBackward(25.0); if(irDetected == true) { driveBackward(15.0); raiseLift(750.0); dropBallCenter(); wait1Msec(300); servo[centerServo] = endPosCenter - 30; lowerLift(1000.0); lowerLift(1000.0); lowerLift(1000.0); lowerLift(1000.0); lowerLift(1000.0); driveForward(105.0); turnRight(85.0); driveBackward(300.0); } else { irPos1 = true; driveBackward(110.0); turnRight(46.0); driveBackward(135.0); turnRight(3.0); raiseLift(750.0); dropBallCenter(); wait1Msec(300); servo[centerServo] = endPosCenter - 30; lowerLift(1000.0); lowerLift(1000.0); lowerLift(1000.0); lowerLift(1000.0); lowerLift(1000.0); driveForward(130.0); turnRight(82.0); driveBackward(300.0); } } else { driveForward(115.0); // ir loop if(irDetected == true) { irPos3 = true; driveBackward(15.0); raiseLift(750.0); dropBallCenter(); wait1Msec(300); servo[centerServo] = endPosCenter - 30; lowerLift(1000.0); lowerLift(1000.0); lowerLift(1000.0); lowerLift(1000.0); lowerLift(1000.0); driveForward(120.0); turnRight(85.0); driveBackward(300.0, 60); /*turnRight(43.0); driveBackward(250.0); motor[rightWheel] = -20; motor[leftWheel] = -20; wait1Msec(200); motor[rightWheel] = 0; motor[leftWheel] = 0; dropClamp(); driveForward(10.0); raiseLift(700.0); dropBallGoal(); resetDropGoal();*/ break; } else { driveBackward(220.0); turnRight(85.0); driveBackward(100.0); } } break; } }
task main() { eraseDisplay(); bool i = inputWaitForStart();//check for wait for start wait1Msec(500); if(i) { waitForStart(); } initializeRobot(); /* nMotorEncoder[left] = 0; while(abs(nMotorEncoder[left]) < inchesToEncoder(32)) { motor[right]=100; motor[left] = 0; PlaySound(soundBeepBeep); } stopMotors(); return; */ driveInches(88,35,35); //drive to tube wait1Msec(500); servoDown(); wait1Msec(500); driveInches(-5); raiseLift(); wait1Msec(500); dump(); wait1Msec(500); dumpUp(); wait1Msec(500); // turn around and drive to ramp nMotorEncoder[left] = 0; //start of floor code //turn around and drive to ramp nMotorEncoder[right] = 0; //start of floor code //go flat against wall while(abs(nMotorEncoder[right]) < inchesToEncoder(20)) { motor[left]= 50; motor[right] = -50; print(nMotorEncoder[left], 4); } //turn towards floor parking zone motor[left]= 100; motor[right] = 0; wait1Msec(200); motor[left] = 0; //drive to parking zone driveInches(120,50,50); //release thingy servoUp(); return; //start of ramp code while(abs(nMotorEncoder[left]) < inchesToEncoder(64)) { motor[right]=100; motor[left] = 0; } stopMotors(); //driveInches(4); //driveInches(40,50,0); turn(LEFT, 40); driveInches(257,100,100); turn(RIGHT, 30); wait1Msec(5000); PlaySound(soundFastUpwardTones); driveInches(30, 50, 50); wait1Msec(500); turn(LEFT, 30); wait1Msec(500); driveInches(30, 50, 50); servoUp(); //drive back off of ramp driveInches(-90); }
task main() { init(); waitForStart(); driveSonar(1,25,80); allStop(); wait1Msec(100); backward(20); wait1Msec(700); sticksDown(); wait1Msec(250); allStop(); wait1Msec(100); raiseLift(100); time1[T1]=0; while (nMotorEncoder[intake] < 410 && 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(80); while (nMotorEncoder[intake] > 220) //while the encoder wheel turns one revolution { } allStop(); wait1Msec(500); releaseAutoBall(); wait1Msec(500); motor[intake] = 100; wait1Msec(1000); motor[intake] = 0; turn(0,180,100); allStop(); wait1Msec(100); drive(1,1,75); sticksUp(); drive(0,1,75); time1[T1]=0; while(SensorValue[sonarSensor]>30||time1[T1]<1200){ left(50); } while(SensorValue[sonarSensor]<200){ left(50); } allStop(); wait1Msec(100); turn(0,25,70); allStop(); wait1Msec(100); driveSonar(1,25,50); backward(30); wait1Msec(700); sticksDown(); wait1Msec(250); allStop(); 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(80); while (nMotorEncoder[intake] > 740) //while the encoder wheel turns one revolution { } allStop(); wait1Msec(500); }
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); }