コード例 #1
0
ファイル: CSB2_Co.c プロジェクト: jasper0918/Botball-HW
int main()
{
	prepare();
	#ifdef	TEST
	test();
	#endif
	move(BALL1);
	#ifdef	TEST
	test();
	#endif
	getBalls();
	#ifdef	TEST
	test();
	#endif
	move(BALL2);
	#ifdef	TEST
	test();
	#endif
	getBalls();
	#ifdef	TEST
	test();
	#endif
	move(BALL3);
	#ifdef	TEST
	test();
	#endif
	getBalls();
	#ifdef	TEST
	test();
	#endif
	move(BALL4);
	#ifdef	TEST
	test();
	#endif
	getBalls();
	#ifdef	TEST
	test();
	#endif
	move(STORAGE1);
	#ifdef	TEST
	test();
	#endif
	releaseBalls(BOX);
	#ifdef	TEST
	test();
	#endif
	move(STORAGE2);
	#ifdef	TEST
	test();
	#endif
	releaseBalls(ROTATOR);
	#ifdef	TEST
	test();
	#endif
	stop();
	
	return 0;
}
コード例 #2
0
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);
}
コード例 #3
0
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);
}
コード例 #4
0
task main()
{
	init();
	waitForStart();
	StartTask(keepHeading);
	StartTask(raiseLiftWhile);
	driveSonar(1,25,50);
	allStop();
	wait1Msec(100);
	backward(20);
	wait1Msec(700);
	sticksDown();
	wait1Msec(250);
	allStop();
	wait1Msec(300);
  //LIFT

	releaseBalls();
	allStop();
	wait1Msec(3000);
	retainBalls();
	allStop();
	wait1Msec(750);
  lowerLift(80);
  while (nMotorEncoder[intake] > 220) //while the encoder wheel turns one revolution
  {
  }
	allStop();
	wait1Msec(100);
	turn(1,19,70);
	allStop();
	wait1Msec(100);
	drive(0,2.0,100);
	allStop();
	wait1Msec(100);
	turn(0,170,100);
	allStop();
	wait1Msec(100);
	sticksUp();
	drive(1,.3,100);
	allStop();
	wait1Msec(100);
	turn(0,180,100);
	allStop();
	wait1Msec(100);
	//while(SensorValue[sonarSensor]>40){
	//	backward(100);
	//}
	//turnToGlobalHeading(-15);
	allStop();
	wait1Msec(100);
	drive(1,1.3,100);
	allStop();
	wait1Msec(100);
	turnToGlobalHeading(-78);
	allStop();
	wait1Msec(100);
	while(SensorValue[sonarSensor]>25){
		backward(30);
	}
	allStop();
	wait1Msec(100);
	while(SensorValue[sonarSensor]<200){
		left(50);
	}
	allStop();
	wait1Msec(100);
	turn(0,18,100);
	allStop();
	wait1Msec(100);
	driveSonar(1,25,50);
	backward(30);
	wait1Msec(700);
	sticksDown();
	wait1Msec(250);
	allStop();
	turn(1,17,70);
	allStop();
	wait1Msec(100);
	drive(0,2.7,100);
	allStop();
	wait1Msec(100);
	turn(0,175,100);
	allStop();
	wait1Msec(50);
	sticksUp();
	drive(1,.8,100);
}