“Motion模块姿态测试示例”的版本间的差异
Radiumray9(讨论 | 贡献) |
Radiumray9(讨论 | 贡献) |
||
第21行: | 第21行: | ||
[[File:motion-weather-bmp180.jpg|800px|thumb|center]] | [[File:motion-weather-bmp180.jpg|800px|thumb|center]] | ||
<source lang="cpp"> | <source lang="cpp"> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
// read raw accel/gyro measurements from device | // read raw accel/gyro measurements from device | ||
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); | accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); | ||
第73行: | 第38行: | ||
Serial.println(gz); | Serial.println(gz); | ||
− | |||
− | |||
− | |||
} | } | ||
</source> | </source> |
2017年12月18日 (一) 07:18的版本
硬件清单
测试MPU6050姿态传感器
// read raw accel/gyro measurements from device
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
// these methods (and a few others) are also available
//accelgyro.getAcceleration(&ax, &ay, &az);
//accelgyro.getRotation(&gx, &gy, &gz);
// display tab-separated accel/gyro x/y/z values
Serial.print("a/g:\t");
Serial.print(ax); Serial.print("\t");
Serial.print(ay); Serial.print("\t");
Serial.print(az); Serial.print("\t");
Serial.print(gx); Serial.print("\t");
Serial.print(gy); Serial.print("\t");
Serial.println(gz);
}
测试BMP180气压传感器
|