コード例 #1
0
int move_bot()
{
    init_sensor_values();
    while(checkobstacle()==0) {}
    buzzer_off();
    if(checkintersection() == 1)
    {
        //communicate with coordinator
        comintersection();
        stop();
        _delay_ms(100);
        return 0;
    }
    else
    {
        follow();
        return 1;
    }
}
コード例 #2
0
void checkfollow(void)
{
	int temp12=0;
	while(1)
	{
		init_sensor_values();
		while(checkobstacle()==0) {} 		
		if(checkintersection() == 1 )
		{	
			temp12++;
			if(temp12==2){ turn_left(); temp12=0; }
			else follow();
			
		}
		else 
		{
			follow();
		}
		
	}
}