void final_ends(void)	//stops robot when it comes to black platform
{
    straight_fwd();		//go straight
    Delay10KTCYx(150);	//0.1875s
    check_sensors();	//constantly keeps checking to see LED combinations
    while(SeeLine.b.Left&&SeeLine.b.CntLeft&&SeeLine.b.Center&&SeeLine.b.CntRight&&SeeLine.b.Right)	//11111	//all LEDs ON
    {
        motors_brake_all();	//stops all motor
        check_sensors();	//constantly keeps checking to see LED combinations
    }
}
示例#2
0
void go_straight(void)
{
     // very simple motor control
     
     if ( SeeLine.b.Center ) straight_fwd();
     else if (SeeLine.b.Left) spin_left();
     else if (SeeLine.b.CntLeft) turn_left();
     else if (SeeLine.b.CntRight) turn_right();
     else if (SeeLine.b.Right) spin_right();

     if ( (SeeLine.B ) == 0b00000u) motors_brake_all();
}