兩輪平衡車程序
stm32源程序如下:
- #include "sys.h"
- #include "delay.h"
- #include "usart.h"
- #include "oled.h"
- #include "PWM.h"
- #include "timer.h"
- #include "PID.h"
- #include "stm32f10x_tim.h"
- #include "24l01.h"
- extern float Pitch1,Pitch_last,out1,out2,c4,Gyro_Y,Yaw;
- extern int Encoder_Right,Encoder_Left;
- extern short aay;
- float speed;
- u8 tmp_buf[8];
- int main(void)
- {
- delay_init(); //延時函數初始化
- NVIC_Configuration(); //設置NVIC中斷分組2:2位搶占優先級,2位響應優先級
- uart_init(9600); //串口初始化為9600
- MPU6050_initialize();
- IIC_Init();
- DMP_Init();
- OLED_Init();
- pwm_Init();
- OLED_Refresh_Gram();
- time1_Init();
- PID_init();
- //NRF24L01_Init();
- //NRF24L01_RX_Mode();
- while(1)
- {
- xianshi();
- printf("gyro[1]=%f\r\n",Yaw);
- }
- }
復制代碼
所有資料51hei提供下載:
兩輪平衡小車.rar
(356.95 KB, 下載次數: 32)
2018-5-8 02:13 上傳
點擊文件名下載附件
開源代碼 下載積分: 黑幣 -5
|