亚洲春色中文字幕久久久-三上亚,一吻二脱三床四吻胸,国产真实伦对白视频全集,在线毛片观看,精品成品入口黄网,国产毛aⅴ片久久久,亚洲AV色香蕉一区二区三区老师,萧皇后A级艳片,色情日本视频更新,99久久亚洲精品日本无码
標(biāo)題:
STM32 MPU6050獲取加速度角速度代碼
[打印本頁]
作者:
wind@
時間:
2018-12-27 14:06
標(biāo)題:
STM32 MPU6050獲取加速度角速度代碼
MPU6050三軸陀螺儀通過IIC讀取獲取角速度及加速度代碼
單片機源程序如下:
//連接方式 :請參考interface.h文件
//部份源碼來源網(wǎng)絡(luò)--請試用24小時后刪除
#include "stm32f10x.h"
#include "interface.h"
#include "LCD1602.h"
#include "IRCtrol.h"
#include "motor.h"
#include "UltrasonicCtrol.h"
#include "redvoid.h"
#include "Usart_Interrupt.h"
#include "stm32f10x_i2c.h"
#include "MPU_IIC.h"
#include "uart.h"
#include "usart.h"
u8 pBuffer;
u8* ppBuffer;
s16 AccelGyro[7]={0};
unsigned char cmd_flag = 0;
unsigned char testbuf[5]="abcdf";
//全局變量定義
unsigned int speed_count=0;//占空比計數(shù)器 50次一周期
char front_left_speed_duty=SPEED_DUTY;
char front_right_speed_duty=SPEED_DUTY;
char behind_left_speed_duty=SPEED_DUTY;
char behind_right_speed_duty=SPEED_DUTY;
unsigned char tick_5ms = 0;//5ms計數(shù)器,作為主函數(shù)的基本周期
unsigned char tick_1ms = 0;//1ms計數(shù)器,作為電機的基本計數(shù)器
unsigned char tick_200ms = 0;//刷新顯示
char ctrl_comm = COMM_STOP;//控制指令
char ctrl_comm_last = COMM_STOP;//上一次的指令
unsigned char continue_time=0;
int main(void)
{
delay_init();
USART1Conf(115200);
// printf("MPU6050 test1--->\n");
I2C_MPU6050_Init();
// printf("MPU6050 test2--->\n");
MPU6050_IniTIalize();
// printf("MPU6050 test3--->\n");
while(1)
{
//MPU6050_I2C_ByteWrite(SlaveAdress,pBuffer,0x68);
//MPU6050_I2C_ByteWrite(u8 slaveAddr, u8 pBuffer, u8 writeAddr)
//MPU6050_I2C_BufferRead(SlaveAdress,ppBuffer,0x68,8);//NumByteToRead?
//MPU6050_I2C_BufferRead(u8 slaveAddr, u8* pBuffer, u8 readAddr, u16 NumByteToRead)
MPU6050_GetRawAccelGyro(AccelGyro);
printf("MPU6050 test3--->\r\n");
// printf("ACC_X = %10.5d\r\n",AccelGyro[0]);
// printf("ACC_Y = %10.5d\r\n",AccelGyro[1]);
// printf("ACC_Z = %10.5d\r\n",AccelGyro[2]);
// printf("GYRO_X = %10.5d\r\n",AccelGyro[3]);
// printf("GYRO_Y = %10.5d\r\n",AccelGyro[4]);
// printf("GYRO_Z = %10.5d\r\n",AccelGyro[5]);
printf("ACC_X = %d\r\n",AccelGyro[0]);
printf("ACC_Y = %d\r\n",AccelGyro[1]);
printf("ACC_Z = %d\r\n",AccelGyro[2]);
printf("GYRO_X = %d\r\n",AccelGyro[3]);
printf("GYRO_Y = %d\r\n",AccelGyro[4]);
printf("GYRO_Z = %d\r\n",AccelGyro[5]);
Delay_us(500000);
}
}
復(fù)制代碼
所有資料51hei提供下載:
MPU6050.7z
(190.45 KB, 下載次數(shù): 84)
2018-12-28 02:03 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
作者:
chaqs3
時間:
2019-8-23 15:52
AccelGyro前三個代表的是xyz軸上的加速度嗎?
歡迎光臨 (http://www.denmoz.com/bbs/)
Powered by Discuz! X3.1