找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1427|回复: 0
收起左侧

STM32A0智能小车 没有程序 求帮助

[复制链接]
ID:954924 发表于 2021-7-20 13:26 | 显示全部楼层 |阅读模式
  1. 部分功能实现:
  2. ①小车前进后退左转右转
  3. #include "stm32f10x.h"
  4. #include "delay.h"
  5. #include "motor.h"
  6. /*
  7. void ZYSTM32_run(int speed,int time);       //前进函数
  8. void ZYSTM32_brake(int time);               //刹车函数
  9. void ZYSTM32_Left(int speed,int time);      //左转函数
  10. void ZYSTM32_Spin_Left(int speed,int time); //左旋转函数
  11. void ZYSTM32_Right(int speed,int time);     //右转函数
  12. void ZYSTM32_Spin_Right(int speed,int time);//右旋转函数
  13. void ZYSTM32_back(int speed,int time);      //后退函数

  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

原理图.zip

226.23 KB, 下载次数: 3, 下载积分: 黑币 -5

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表