標題: 兩輪平衡車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();                     //延時函數(shù)初始化          
  18.         NVIC_Configuration();          //設置NVIC中斷分組2:2位搶占優(yōu)先級,2位響應優(yōu)先級
  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, 下載次數(shù): 32)







歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1