| 参数维度 | 规格详情 |
|---|---|
| 产品型号 | A024 |
| 产品重量 | 带壳重量:9克——裸板重量:3克 |
| 产品名称 | MPU6050 陀螺仪加速度传感器 (A024) |
| 通信方式 | I2C 通讯,最大 400KHz 速率 |
| 接口类型 | PH2.0 4P 端子 |
| 安装方式 | 螺丝固定 |
| 工作电压 | 3.3V~5V (直流 DC) |
| 陀螺仪运作电流 | 5mA |
| 模块尺寸 | 见附图 |
| 引脚定义 |
电源负极- GND 电源正极 - VCC I2C 数据引脚 (SDA) I2C 时钟引脚 (SCL) |
| 可选包装方案 | ①防静电袋软包 ②白卡挂孔盒 ③牛皮纸盒 |

#include <Wire.h>
const int MPU_ADDR = 0x68;
int16_t AcX, AcY, AcZ, GyX, GyY, GyZ;
void setup() {
Serial.begin(9600);
Wire.begin();
// 唤醒MPU6050
Wire.beginTransmission(MPU_ADDR);
Wire.write(0x6B);
Wire.write(0);
Wire.endTransmission(true);
}
void loop() {
Wire.beginTransmission(MPU_ADDR);
Wire.write(0x3B);
Wire.endTransmission(false);
Wire.requestFrom(MPU_ADDR, 14, true);
AcX = Wire.read() << 8 | Wire.read();
AcY = Wire.read() << 8 | Wire.read();
AcZ = Wire.read() << 8 | Wire.read();
GyX = Wire.read() << 8 | Wire.read();
GyY = Wire.read() << 8 | Wire.read();
GyZ = Wire.read() << 8 | Wire.read();
Serial.print("Accel: ");
Serial.print(AcX); Serial.print(" ");
Serial.print(AcY); Serial.print(" ");
Serial.print(AcZ); Serial.print(" | ");
Serial.print("Gyro: ");
Serial.print(GyX); Serial.print(" ");
Serial.print(GyY); Serial.print(" ");
Serial.println(GyZ);
delay(200);
}