分享一個紅外避障小車的例程
單片機源程序如下:
- #include "stm32f10x.h"
- #include "delay.h"
- #include "motor.h"
- #include "keysacn.h"
- #include "IRSEARCH.h"
- #include "IRAvoid.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();
- IRSearchInit();
- IRAvoidInit();
- TIM4_PWM_Init(7199,0); //初始化PWM
- ZYSTM32_brake(500);
- keysacn();
- while(1)
- {
- AVoidRun(); //避障函數
- }
- }
復制代碼
所有資料51hei提供下載:
智能小車紅外避障實驗(帶后退掉頭避障).rar
(294.32 KB, 下載次數: 122)
2018-10-20 00:22 上傳
點擊文件名下載附件
|