 |
 |
Motor |
 |
Back |
extern
void object::Motor( )
{
while ( true )
{
object spot;
float dir;
spot = radar(WayPoint);
if ( spot == null ) //
no waypoint to find ?
{
motor(0, 0); //
stop moving
break; //
exit loop
}
dir = direction(spot.position);
if ( dir < 0 ) //
waypoint on the right ?
{
motor(1, 1+dir/90);
}
else // or on
the left ?
{
motor(1-dir/90, 1);
}
}
} |
|