GeBalanceBot/4.WHEELTEC B570 平衡小车源码(库函数精.../USER/MiniBalance.c

46 lines
1.5 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/***********************************************
公司:轮趣科技(东莞)有限公司
品牌WHEELTEC
官网wheeltec.net
淘宝店铺shop114407458.taobao.com
速卖通: https://minibalance.aliexpress.com/store/4455017
版本5.7
修改时间2021-04-29
Brand: WHEELTEC
Website: wheeltec.net
Taobao shop: shop114407458.taobao.com
Aliexpress: https://minibalance.aliexpress.com/store/4455017
Version:5.7
Update2021-04-29
All rights reserved
***********************************************/
#include "stm32f10x.h"
#include "sys.h"
u8 Flag_Stop=1; //电机停止标志位,默认关闭
int Encoder_Left,Encoder_Right; //左右编码器的脉冲计数
float Angle_Balance,Gyro_Balance; //平衡倾角 平衡陀螺仪
int main(void)
{
MY_NVIC_PriorityGroupConfig(2); //设置中断分组
delay_init(); //延时函数初始化
JTAG_Set(JTAG_SWD_DISABLE); //关闭JTAG接口
JTAG_Set(SWD_ENABLE); //打开SWD接口 可以利用主板的SWD接口调试
KEY_Init(); //按键初始化
MiniBalance_PWM_Init(7199,0); //初始化PWM 10KHZ用于驱动电机 如需初始化电调接口 改为MiniBalance_PWM_Init(9999,35) 200HZ
Encoder_Init_TIM2(); //编码器接口
Encoder_Init_TIM4(); //初始化编码器2
IIC_Init(); //IIC初始化
OLED_Init(); //OLED初始化
MPU6050_initialize(); //MPU6050初始化
DMP_Init(); //初始化DMP
MiniBalance_EXTI_Init(); //MPU6050 5ms定时中断初始化
while(1)
{
oled_show(); //显示屏打开
}
}