标题: 两轮平衡车stm32程序 [打印本页]

作者: a43769745    时间: 2018-5-7 10:34
标题: 两轮平衡车stm32程序
两轮平衡车程序

stm32源程序如下:
  1. #include "sys.h"
  2. #include "delay.h"
  3. #include "usart.h"
  4. #include "oled.h"
  5. #include "PWM.h"
  6. #include "timer.h"
  7. #include "PID.h"
  8. #include "stm32f10x_tim.h"
  9. #include "24l01.h"
  10. extern        float Pitch1,Pitch_last,out1,out2,c4,Gyro_Y,Yaw;
  11. extern int Encoder_Right,Encoder_Left;
  12. extern short aay;
  13. float speed;
  14. u8 tmp_buf[8];
  15. int main(void)
  16. {       
  17.         delay_init();                     //延时函数初始化          
  18.         NVIC_Configuration();          //设置NVIC中断分组2:2位抢占优先级,2位响应优先级
  19.   uart_init(9600);         //串口初始化为9600
  20.   MPU6050_initialize();
  21.         IIC_Init();
  22.         DMP_Init();
  23.         OLED_Init();
  24.         pwm_Init();
  25.         OLED_Refresh_Gram();
  26.   time1_Init();
  27.         PID_init();
  28. //NRF24L01_Init();
  29.         //NRF24L01_RX_Mode();
  30.         while(1)
  31.         {
  32.         xianshi();
  33.         printf("gyro[1]=%f\r\n",Yaw);       
  34.         }
  35. }

复制代码

所有资料51hei提供下载:
两轮平衡小车.rar (356.95 KB, 下载次数: 32)







欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1