コード例 #1
0
ファイル: main.c プロジェクト: rohankaps123/Micromouse2014
int main(void)
{
	setupADC();	
	setupStepperMotor();
	startTimer();

	USART_init();
	
	mouse.velocity = 0;
	mouse.maxVelocity = 5000;
	mouse.acceleration = 2000;
	mouse.deceleration = 10000;

	enableDrive(1);
	turnOnTimers(1,1);
	
	for(int i = 0; i < 10; i++)
	{		
		int right = isWallRight();
		int front = isWallFront();
		int left = isWallLeft();
		
		if(!right)
		{
			rotateRight();
		}
		else if(front && !left)
		{
			rotateLeft();
		}
		else if(front)
		{
			moveBackwardsAndCorrect();
		}	
		
		if(left && right)		
			mouse.IR_CORRECT = 20;
		
		moveForwardAndStop();
		
		mouse.IR_CORRECT = 0;
		
		
	}

	
	turnOnTimers(0, 0);
	enableDrive(0);
	
	
	while(1==1)
	{

	}	
}
コード例 #2
0
ファイル: MouseManager.c プロジェクト: JMarple/Micromouse2014
//Reset and start all mouse constants and timers
void initializeMouse()
{
	setupADC();	
	setupStepperMotor();
	startTimer();
	
	USART_init();
	
	mouse.velocity = 0;
	mouse.maxVelocity = 2500;
	mouse.acceleration = 3000;
	mouse.deceleration = 12000;

	enableDrive(1);
	turnOnTimers(1,1);
}