#include "gpio.h"
#include "sys.h"
#include "delay.h"
#include "pwm.h"
#include "pwm2.h"
#include "usart2.h"
u8 i;
u8 flag; //定义一个标志位
void USART2_IRQHandler(void)
{
if(USART_GetITStatus(USART2, USART_IT_RXNE) == SET) //检查指定的 USART2 中断发生与否
{
USART_ClearITPendingBit(USART2, USART_IT_RXNE); //清除 USART2 的中断待处理位
i= USART_ReceiveData(USART2); //返回 USART2 最近接收到的数据
printf("%c",i);
//if语句的内容部分可以保证蓝牙接收到的flag数据是正确的,如果不加的话会导致接收不到正确的数据
if(i=='0')
{
flag=0;
}
if(i=='1')
{
flag=1;
}
if(i=='2')
{
flag=2;
}
if(i=='3')
{
flag=3;
}
if(i=='4')
{
flag=4;
}
if(i=='5')
{
flag=5;
}
if(i=='6')
{
flag=6;
}
}
}
int main()
{
while(1)
{
My_USART2_Init();
delay_init();
gpio_Init();
TIM1_PWM_Init(7199,0);
TIM3_PWM2_Init(7199,0);
TIM_SetCompare1(TIM1,1500);
TIM_SetCompare3(TIM3,1500);
switch(flag)
{
case 0: stop(); break ;
case 1: front(); break ;
case 2: left(); break ;
case 3: right(); break ;
case 4: turnleft(); break ;
case 5: turnright(); break ;
case 6: back(); break;
default: stop(); break ;
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
STM32蓝牙+超声波+舵机.rar
共219个文件
d:41个
o:40个
crf:39个
5星 · 超过95%的资源 需积分: 45 41 下载量 191 浏览量
2020-05-03
16:18:41
上传
评论 5
收藏 5.61MB RAR 举报
温馨提示
以STM32F103RCT6为基础 超声波+舵机避障小车,蓝牙遥控程序在read me中可能需要自己改IO口,亲测可用,新手代码多多包涵
资源推荐
资源详情
资源评论
收起资源包目录
STM32蓝牙+超声波+舵机.rar (219个子文件)
TEM.axf 350KB
TEM_sct.Bak 494B
stm32f10x_tim.c 107KB
stm32f10x_flash.c 61KB
stm32f10x_rcc.c 50KB
stm32f10x_adc.c 46KB
stm32f10x_i2c.c 45KB
stm32f10x_can.c 44KB
stm32f10x_usart.c 37KB
system_stm32f10x.c 36KB
stm32f10x_fsmc.c 35KB
stm32f10x_spi.c 30KB
stm32f10x_dma.c 29KB
stm32f10x_sdio.c 28KB
stm32f10x_gpio.c 23KB
stm32f10x_dac.c 19KB
core_cm3.c 17KB
stm32f10x_cec.c 11KB
stm32f10x_pwr.c 9KB
stm32f10x_rtc.c 8KB
stm32f10x_bkp.c 8KB
delay.c 8KB
misc.c 7KB
stm32f10x_exti.c 7KB
stm32f10x_wwdg.c 6KB
stm32f10x_dbgmcu.c 5KB
stm32f10x_iwdg.c 5KB
usart.c 5KB
stm32f10x_it.c 4KB
timer.c 4KB
stm32f10x_crc.c 3KB
usart2.c 3KB
pwm2.c 2KB
pwm.c 2KB
sg90.c 2KB
gpio.c 2KB
main.c 2KB
hc05.c 1KB
sys.c 872B
stm32f10x_tim.crf 362KB
hc05.crf 358KB
stm32f10x_can.crf 349KB
stm32f10x_adc.crf 348KB
stm32f10x_rcc.crf 348KB
stm32f10x_flash.crf 348KB
timer.crf 347KB
main.crf 347KB
usart.crf 347KB
stm32f10x_i2c.crf 347KB
usart2.crf 346KB
stm32f10x_usart.crf 346KB
stm32f10x_fsmc.crf 346KB
stm32f10x_sdio.crf 345KB
stm32f10x_spi.crf 345KB
stm32f10x_gpio.crf 344KB
stm32f10x_dma.crf 344KB
gpio.crf 343KB
stm32f10x_dac.crf 342KB
stm32f10x_cec.crf 342KB
system_stm32f10x.crf 342KB
delay.crf 342KB
sg90.crf 342KB
pwm2.crf 342KB
pwm.crf 342KB
stm32f10x_bkp.crf 342KB
stm32f10x_rtc.crf 342KB
stm32f10x_pwr.crf 342KB
led.crf 341KB
stm32f10x_exti.crf 341KB
sys.crf 341KB
stm32f10x_wwdg.crf 341KB
misc.crf 341KB
stm32f10x_iwdg.crf 340KB
stm32f10x_crc.crf 340KB
stm32f10x_it.crf 340KB
stm32f10x_dbgmcu.crf 340KB
houtui.crf 340KB
core_cm3.crf 4KB
stm32f10x_dbgmcu.d 2KB
stm32f10x_usart.d 2KB
stm32f10x_flash.d 2KB
stm32f10x_wwdg.d 2KB
stm32f10x_exti.d 2KB
stm32f10x_sdio.d 2KB
stm32f10x_gpio.d 2KB
stm32f10x_iwdg.d 2KB
stm32f10x_fsmc.d 2KB
hc05.d 2KB
main.d 2KB
stm32f10x_cec.d 2KB
stm32f10x_rcc.d 2KB
stm32f10x_dac.d 2KB
stm32f10x_i2c.d 2KB
stm32f10x_crc.d 2KB
stm32f10x_pwr.d 2KB
stm32f10x_spi.d 2KB
stm32f10x_adc.d 2KB
stm32f10x_bkp.d 2KB
stm32f10x_tim.d 2KB
stm32f10x_rtc.d 2KB
共 219 条
- 1
- 2
- 3
资源评论
- 简甜XIU091610272023-07-25不仅有理论知识的介绍,还有具体的实践案例,我觉得这个文件是一个很好的学习资料。
- XU美伢2023-07-25这个文件内容全面,关于STM32蓝牙、超声波和舵机的信息都涵盖了,真的非常适合初学者。
- 三山卡夫卡2023-07-25文件中的示意图非常有助于理解设计思路,对我这种对电路图不太熟悉的人来说是个大助力。
- 曹将2023-07-25里面的代码示例简洁明了,对于使用STM32的人来说非常友好,很容易上手。
- 石悦2023-07-25文件里的资料很实用,特别是关于蓝牙和超声波的应用,让我对这些技术有了更深入的了解。
Physics.k
- 粉丝: 141
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功