À¶ÑÀС³µÉè¼ÆÓëÖÆ×÷
6.2Éè¼ÆµÄ×ܽá
²Î¿¼ÎÄÏ× ¸½ ¼A
C? Cap 30pf C? 2 U1 VCC Y? XTAL 19 XTAL1 18 XTAL2 40 VCC VCC L298N +5V +12V IN1 IN2 M-A2 IN3 M-A1 IN4 M-B1 GNDM-B2 ¦Ì??¨²?????¡ê?¨¦ +12V
1 30pf R? Cap Res2 10K S? SW-PB C? 0.1uF Cap Pol1 HC-06 VCC +5V 4 3 GND TXD 2 RXD 1 ¨¤??¨¤?¡ê?¨¦ 9 RST 31 EA/VPP 29 PSEN 30 ALE 10 11 12 13 14 15 16 17 P3.0/RxD P3.1/TxD P3.2/INT0 P3.3/INT1 P3.4/T0 P3.5/T1 P3.6/WR P3.7/RD 39 P0.0/AD0 38 P0.1/AD1 37 P0.2/AD2 36 P0.3/AD3 35 P0.4/AD4 34 P0.5/AD5 33 P0.6/AD6 32 P0.7/AD7 1 P1.0/T2 2 P1.1/T2EX 3 P1.2 4 P1.3 5 P1.4 6 P1.5 7 P1.6 8 P1.7 P2.0/A8 21 22 P2.1/A9 23 P2.2/A10 24 P2.3/A11 25 P2.4/A12 26 P2.5/A13 27 P2.6/A14 28 P2.7/A15 M-A1 M-A2
M-A1 M-B1 M-B2
M-A M-A2 M Motor M-B1 M-B M-B2 M Motor +12V +11.1V 20 VSS STC 89C52 18650
ͼ12£ºÀ¶ÑÀС³µµç·ÔÀíͼ
16
À¶ÑÀС³µÉè¼ÆÓëÖÆ×÷
¸½Â¼B
ͼ13£ºÕû³µÊµÎïͼ
17
À¶ÑÀС³µÉè¼ÆÓëÖÆ×÷
¸½Â¼C
Éè¼Æ³ÌÐò£º³ÌÐò½öΪ²Î¿¼£¬¾ßÌåÉè¼ÆÇë×ÔÐбàд
/********************************************************/ #include \
sbit motor_control_1 = P0^0;//×óÂÖǰ½ø sbit motor_control_2 = P0^1;//×óÂÖºóÍË sbit motor_control_3 = P0^2;//ÓÒÂÖǰ½ø sbit motor_control_4 = P0^3;//ÓÒÂÖºóÍË unsigned char ucBluetoothData = 230; void initial_myself(); void initial_peripheral(); void T0_time();
void usart_service(void);
void delay_long(unsigned int uiDelayLong); void go_forward(void);//ǰ½ø void fall_back(void);//ºóÍË void turn_left(void);//×óת void turn_right(void);//ÓÒת void stop(); void main() {
initial_myself();
18
À¶ÑÀС³µÉè¼ÆÓëÖÆ×÷
delay_long(100); initial_peripheral(); while(1) {
usart_service(); } }
//´®¿Ú·þÎñº¯Êý void usart_service() {
switch(ucBluetoothData) {
case 0x41: //case 0x04://ǰ½ø ucBluetoothData = 0x02; go_forward(); break;
case 0x42 : // case 0x05://×óת ucBluetoothData = 0x02; turn_left(); break;
case 0x44: // case 0x06://ÓÒת ucBluetoothData = 0x02;
19