void center_defense()
{
	CW180();
	sleep(0.5);
	claw_down();
	sleep(0.5);
	turnStraight(200, 100);
	forwardT(100, 1);
	CCW();
	patrol();
}
예제 #2
0
int main(){
	claw_init();
	while(1){
		WAIT(a_button());
		msleep(300);
		WAIT(!a_button());
		claw_down();
		msleep(300);
		claw_up();
	}
}
void biofuel_block()
{
	CW();
	sleep(0.5);
	forwardT(500, 3.2);
	sleep(0.5);
	claw_down();
	sleep(0.5);	
	turnStraight(500, 250);
	sleep(0.1);
	claw_up();
	forwardT(100, 2);
	sleep(1);
	CCW();
	forwardT(300, 2.5);
	sleep(0.1);
	patrol();
}
void bordercross()
{
	float sec1 = seconds();
	float sec2;
	float sec3;
	claw_up();
	sleep(0.5);
	toTouch(500);
	sleep(0.2);
	reverseT(500, 0.5);
	sleep(1);
	CCW();
	sleep(1);
	forwardT(1000, 3);
	sleep(0.5);
	CCW();
	reverseT(500, 1);
	sec2 = seconds();
	sec3 = sec2 - sec1;
	while (sec3 < 15)
	{
		sec2 = seconds();
		sec3 = sec2 - sec1;
	}
	beep();
	forwardT(1000, 6);
	sleep(0.3);
	claw_down();
	sleep(1);
	if(IR_left > threshold && IR_right > threshold)
	{
		while (1)
		{
			ao();
		}
	}
	sleep(1);
	claw_up();
	sleep(0.5);
	reverseT(500, 1.5);
	sleep(1);
}
int main()
{
	enable_servos();
	claw_down();
	
	whichSide();
	
	strategySelect();
	
	//wait_for_light(7);
	
	if (strategy == 1)
	{
		printf("Running luggage carts...\n");
		run_for(117, strategy_1);
		start_process(*countdown);
	}
	
	if (strategy == 2)
	{
		printf("Running tower tip...\n");
		run_for(117, strategy_2);
		start_process(*countdown);
	}
	
	if (strategy == 3)
	{
		printf("Running biofuel block...\n");
		run_for(117, strategy_3);
		start_process(*countdown);
	}
	
	if (strategy == 4)
	{
		printf("Running center defense...\n");
		run_for(117, strategy_4);
		start_process(*countdown);
	}
	
}