# defineuchar? Not signed? tea
# Definition? uint? Not signed? Internationalorganizations (same as international organizations)
sbit? p 1_o=p 1^0;
sbit? p 1_ 1=p 1^ 1;
sbit? p 1_2=p 1^2;
sbit? p 1_3=p 1^3;
sbit? p0_2=p0^ 1;
sbit? p0_3=p0^2;
Invalid? delaym 1(uint? z)
{
uint? Me;
for(I = 0; I & ltz;; i++);
}
Invalid? Major (invalid)
{?
while( 1);
{
? TRIG = 1;
? Delay (1);
? TRIG = 0;
? while(ECHO = = 0);
? while(ECHO== 1)? a++; ? //a Add 1 at a time, and the time is about 2 1us.
? Delay (30);
? a =((340 * a * 2 1)/ 1000)/2;
? Display ();
? scan();
? z = a;
? a = 0;
? Delay (200); }
Invalid? zhiliudianji 1()
{
uint? I,j;
P0 = 0X00?
//Walk in a straight line
for(I = 0; I & lt200; i++)
{? for(I = 0; I & lt500; i++)
? {?
? P0 _ O = 1;
? P0 _ 1 = 0;
? ? delay m 1(280);
? P0 _ O = 0;
? P0 _ 1 = 0;
? P0 _ 2 = 1;
? P0 _ 3 = 0;
? delay m 1(420);
? P0 _ 2 = 0;
? P0 _ 3 = 0;
}
P0 = 0X00
? delay m 1(30000);
? delay m 1(30000); }
//Turn right
Invalid? DC Store 2 ()
{ for(j = 0; j & lt300; j++)
{ P0 _ O = 1;
P0 _ 1 = 0;
? delay m 1(300);
? P0 _ O = 0;
? P0 _ 1 = 0;
P0 _ 2 = 1;
? P0 _ 3 = 0;
? delay m 1( 160);
? P0 _ 2 = 0;
? P0 _ 3 = 0;
? }
P0 = 0X00
delay m 1(30000);
delay m 1(30000);
//Turn left
Invalid? DC Store Set 3 ()
{ for(I = 0; I & lt600; i++)
? {?
? P0 _ O = 1;
? P0 _ 1 = 0;
? ? delay m 1( 155);
? P0 _ O = 0;
? P0 _ 1 = 0;
? P0 _ 2 = 1;
? P0 _ 3 = 0;
? delay m 1(650);
? P0 _ 2 = 0;
? P0 _ 3 = 0;
}
P0 = 0X00
delay m 1(30000);
? delay m 1(30000); }
P0 = 0x00
while( 1);
}
}
Invalid? Major (invalid)
{?
while( 1)
{
? TRIG = 1;
? Delay (1);
? TRIG = 0;
? while(ECHO = = 0);
? while(ECHO== 1)? a++; ? //a Add 1 at a time, and the time is about 2 1us.
? Delay (30);
? a =((340 * a * 2 1)/ 1000)/2;
If (a==50)
esle
{? Invalid? zhi Liu dianji 3(); }
Delay (200);
Invalid? zhiliu dianji 1();
? z = a;
? a = 0;
? Delay (200);
}