找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 1987|回復: 0
打印 上一主題 下一主題
收起左側

STM32A0智能小車 沒有程序 求幫助

[復制鏈接]
跳轉到指定樓層
樓主
ID:954924 發(fā)表于 2021-7-20 13:26 | 只看該作者 |只看大圖 回帖獎勵 |倒序瀏覽 |閱讀模式
  1. 部分功能實現(xiàn):
  2. ①小車前進后退左轉右轉
  3. #include "stm32f10x.h"
  4. #include "delay.h"
  5. #include "motor.h"
  6. /*
  7. void ZYSTM32_run(int speed,int time);       //前進函數(shù)
  8. void ZYSTM32_brake(int time);               //剎車函數(shù)
  9. void ZYSTM32_Left(int speed,int time);      //左轉函數(shù)
  10. void ZYSTM32_Spin_Left(int speed,int time); //左旋轉函數(shù)
  11. void ZYSTM32_Right(int speed,int time);     //右轉函數(shù)
  12. void ZYSTM32_Spin_Right(int speed,int time);//右旋轉函數(shù)
  13. void ZYSTM32_back(int speed,int time);      //后退函數(shù)

  14. */


  15. int main(void)
  16. {        
  17.          delay_init();
  18.          TIM4_PWM_Init(7199,0);  //初始化PWM
  19.                 while(1)
  20.                 {  
  21.                  ZYSTM32_back(50,1000);//后退1s
  22.                  ZYSTM32_brake(500);//停止0.5S
  23.      ZYSTM32_run(50,1000);//前進1S
  24.                  ZYSTM32_brake(500);//停止0.5S
  25.      ZYSTM32_Left(50,1000);//左轉1S
  26.      ZYSTM32_Right(50,1000);//右轉1S
  27.            ZYSTM32_Spin_Right(50,1000);//向右旋轉2S
  28.      ZYSTM32_Spin_Left(50,1000);//向左旋轉2S
  29.      ZYSTM32_brake(500);//停止0.5S                 
  30.                 }
  31. }

復制代碼

小車實物圖+板子原理圖

23fbe891fde140330240c8653114105.jpg (1.97 MB, 下載次數(shù): 106)

23fbe891fde140330240c8653114105.jpg

原理圖.zip

226.23 KB, 下載次數(shù): 3, 下載積分: 黑幣 -5

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表