if(KEY_CONTROL_MODE==0) { }
if(KEY_UP==0) { }
if(KEY_DOWN==0) {
delay(20);
if(KEY_CONTROL_MODE==0) { }
while(KEY_CONTROL_MODE==0); delay(20);
while(KEY_CONTROL_MODE==0);
CONTROL_MODE_FLAG=0; play(0,2,dis1);显示重力模式
delay(20); if(KEY_UP==0) { }
while(KEY_UP==0); delay(20);
while(KEY_UP==0);
CONTROL_MODE_FLAG=2; play(0,2,dis3);显示循迹模式
delay(20);
if(KEY_DOWN==0) {
21
}
}
CONTROL_MODE_FLAG=3; play(0,2,dis4);显示避障模式
while(KEY_DOWN==0); delay(20);
while(KEY_DOWN==0);
break;
case 2:
if(KEY_CONTROL_MODE==0) { }
delay(20);
if(KEY_CONTROL_MODE==0) { }
while(KEY_CONTROL_MODE==0); delay(20);
while(KEY_CONTROL_MODE==0);
CONTROL_MODE_FLAG=0; play(0,2,dis1);显示按键模式
break;
case 3:
if(KEY_CONTROL_MODE==0) {
delay(20);
if(KEY_CONTROL_MODE==0)
22
}
{ }
while(KEY_CONTROL_MODE==0); delay(20);
while(KEY_CONTROL_MODE==0);
CONTROL_MODE_FLAG=0; play(0,2,dis1);显示按键模式
}
break;
***************液晶背光控制**********
if(aa%5==0) {
if(BACK_LED_FLAG) { }
if(IR_LED==0){ BACK_LED_FLAG=1;bb=0;BACK_LED=1; }
bb++;
if(bb==400){ BACK_LED_FLAG=0;bb=0;BACK_LED=0; }
********************************* }
void timer() interrupt 1
23 }
}
{ }
TH0=(65535-50000)256; TL0=(65535-50000)%6; aa++;
if(aa==20) { aa=0; lcd_pos(1,5); lcd_wdat(30); lcd_pos(2,4); lcd_wdat(17); lcd_pos(2,6); lcd_wdat(16); lcd_pos(3,5); lcd_wdat(31); }
文件二< init.);
void init_NRF24L01(void); uint SPI_RW(uint uchar);
uint SPI_RW_Reg(uchar reg, uchar value);
uint SPI_Write_Buf(uchar reg, uchar *pBuf, uchar uchars); void nRF24L01_TxPacket(unsigned char * tx_buf);
sbit SCL=P1^0;
IIC时钟引脚定义
24