Include
Include
h"
int ir_1=0;
void main()
{int i;
int ir_1=0;
int flag=1;
while(!ir_detector());
while(1){
if(ir_detector()==1||ir_detector()==4||ir_detector()==2)
{motor( 1 , 30 );//直行 1m
motor( 2 , 30 );
wait( 2.500000 );
drive( 0 ,30);//右转
wait( 0.2 );
stop();
motor( 1 , 30 );
motor( 2 , 30 );
wait( 3.500000 );直行 1.5m
stop();}}
}
#include "AS_UIII_LIB.h"
int s[100];
void main()
{
int i;
Beep();
for(i=0;i<40;++i)
{
switch(ir_detector())
{
case 0:s[i]=0;stop();break;
case 1:s[i]=1;motor(1,25);motor(2,12);break;
case 2:s[i]=2;motor(1,12);motor(2,25);break;
case 4:s[i]=4;motor(1,25);motor(2,25);break;
}
wait(0.3);
if(microphone()>400)
{
s[i+1]=5;
break;
}
}
stop();
Beep();
wait(3.0);
while(microphone()<400);
Beep();
for(i=0;i<40&&s[i]!=5;++i)
{
switch(s[i])
{
case 0:stop();break;
case 1:motor(1,25);motor(2,12);break;
case 2:motor(1,12);motor(2,25);break;
case 4:motor(1,25);motor(2,25);break;
}
tone(440.0,0.15);tone(523.2,0.1);tone(523.2,0.1);
}
stop();
Beep();
}
#include "AS_UIII_LIB.h"
int photo_1=0;
int bmp_1=0;
int mic_1=0;
int ir_1=0;
void main()
{
/**/
int mic_1=0;
while(1)
{
mic_1 = microphone();
if( mic_1 > 300)
{
motor(1,30);motor(2,30);wait(1.5); // 直行
drive( 0 ,37); //120
wait( 0.26);
stop();
motor( 1 , 30 );
motor( 2 , 30 );
wait(1.500000 );
while(1)
{
photo_1 = photo(1);