MPU6050数据分析与滤波
3.代码部分
ARDUINO 代码复制打印 1. #include "Wire.h"
2. #include "I2Cdev.h"
3. #include "MPU6050.h"
4. MPU6050 accelgyro;
5. int16_t ax, ay, az;
6. int16_t gx, gy, gz;
7.
8. float C_Z = -1343.91;//Z轴零点偏移量
9. float C_Gyro = -99.90;//陀螺仪零点偏移量
10.
11.
12.
13.
14.
15.
16. float Z_Min = -17873.76;//最小极值 float Z_Max = 15186.91;//最大极值 float T_Z = 3;//Z轴角度补偿时间常数 float R_Z = 180/(Z_Max - Z_Min);//Z轴比例 float R_Gyro = 0.081;//陀螺仪比例 unsigned long T_Now =0;//系统当前时间 unsigned long T_Last;//上次时间
17. float Angle_G,Angle_AG,Angle_GG;
18. int i;
19. float GYRO;
20.
21. void setup() {
22. Wire.begin();
23. Serial.begin(38400);
24. // initialize device
25. Serial.println("Initializing I2C
devices...");
26. accelgyro.initialize();
27. // verify connection
28. Serial.println("Testing device
connections...");
29. Serial.println(accelgyro.testConnection() ?
"MPU6050 connection successful" : "MPU6050
搜索“diyifanwen.net”或“第一范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,第一范文网,提供最新工程科技MPU6050数据分析与滤波(3)全文阅读和word下载服务。
相关推荐: