基于STM32的智能避障程序
单片机源程序如下:
- #include "stm32f10x.h"
- #include "delay.h"
- #include "motor.h"
- #include "keysacn.h"
- #include "IRAvoid.h"
- #include <exti.h>
- /*
- void ZYSTM32_run(int speed,int time); //前进函数
- void ZYSTM32_brake(int time); //刹车函数
- void ZYSTM32_Left(int speed,int time); //左转函数
- void ZYSTM32_Spin_Left(int speed,int time); //左旋转函数
- void ZYSTM32_Right(int speed,int time); //右转函数
- void ZYSTM32_Spin_Right(int speed,int time);//右旋转函数
- void ZYSTM32_back(int speed,int time); //后退函数
- */
- int main(void)
- {
- delay_init();
- KEY_Init();
- IRAvoidInit();
- TIM4_PWM_Init(7199,0); //初始化PWM
- ZYSTM32_brake(500);
- keysacn();
-
- while(1)
- {
- GPIO_ResetBits(GPIOA,GPIO_Pin_4);
- GPIO_SetBits(GPIOB,GPIO_Pin_9);
- }
- }
复制代码
所有资料51hei提供下载:
智能小车红外避障实验(带后退掉头避障).7z
(191.31 KB, 下载次数: 13)
|