1yqDpVFs

51 Bluetooth Car

 
Overview
The reason for creating this project is
that after learning about 51 microcontrollers, you must want to create your own project design. So this project was created. You can copy this project, modify the board style, draw a 3D shell you like, and modify the code to add more interesting modules! Code for
displaying photos #include #define uchar unsigned char #define uint unsigned int sbit LB=P3^4; // out2 Motor sbit LF=P3^5; // out1 Motor sbit RB=P3^6; // out4 Motor sbit RF=P3^7; // out3 Motor sbit L1=P3^2; // LED car lights sbit L2=P3^3; // FMQ horn void Delay(uint a) { while(a--); } void stop() // Bluetooth control stop { LF=0; LB=0; RF=0; RB=0; L1=0; L2=1; } void forward()// forward { LF=1; LB=0; RF=1; RB=0; L1=0; L2=1; } void back()// back { LF=0; LB=1; RF=0; RB=1; L1=0; L2=1; } void left()//Left { LF=0; LB=1; RF=1; RB=0; L1=0; L2=1; } void right()//Right { LF=1; LB=0; RF=0; RB=1; L1=0; L2=1; } void fmq()//Buzzer sounds continuously { L2=0; } void fmj()//Turn off the buzzer (not very useful at the time due to logical confusion) { L2=1; } void led1()//Car lights (not set yet) { LF=0; LB=0; RF=0; RB=0; L1=1; L2=1; } void led2()//Car lights (not set yet) { LF=0; LB=0; RF= 0; RB=0; L1=0; L2=0; } void Com_Int(void) interrupt 4 { uchar receive_data; EA = 0; if(RI == 1) { RI=0; LF=0; RF=0; LB=0; RB=0; L1=0; L2=0; receive_data = SBUF; switch(receive_data)//Character definition Bluetooth control { case ('1'): forward();break; case ('2'): back();break; case ('3'): left();break; case ('4'): right();break; case ('9'): stop();break;





























































































































case ('5'):
fmq();break;
case ('6'):
fmj();break;
case ('7'):
led1();break;
case ('8'):
led2();break;
}
}
EA = 1;
}

void UsartConfiguration()//
{
SCON=0X50; //
TMOD=0X20;
PCON=0X00;
TH1=0Xfd;
TL1=0Xfd; //
TR1= 1;
ES = 1;
EA = 1;
}

void main()
{
unsigned int D=0;

UsartConfiguration();
while(1) //Flowing light
{
for(D=0;D<8;D++)
{
P1=~(0x01<
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-27 12:21:47

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号