|
兩輪平衡車(chē)程序
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(); //延時(shí)函數(shù)初始化
- NVIC_Configuration(); //設(shè)置NVIC中斷分組2:2位搶占優(yōu)先級(jí),2位響應(yīng)優(yōu)先級(jí)
- 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);
- }
- }
復(fù)制代碼
所有資料51hei提供下載:
兩輪平衡小車(chē).rar
(356.95 KB, 下載次數(shù): 32)
2018-5-8 02:13 上傳
點(diǎn)擊文件名下載附件
開(kāi)源代碼 下載積分: 黑幣 -5
|
|