SensorMotion.setFullScaleAccelRange()
Machine1987(讨论 | 贡献)2017年7月27日 (四) 03:38的版本
sensorMotion.setFullScaleAccelRange(uint8_t _range)
- 作用:
设置Sensor_Motion的加速度计量程
- 参数:
_range:加速度计量程,取值范围是ACCEL_FS_2、ACCEL_FS_4、ACCEL_FS_8、ACCEL_FS_16,分别代表满量程时2、4、8、16g的检测上限。
- 例子:这里以俯仰角输出为例
#include <Sensor_Motion.h>
sensorMotion motion(&Serial1);
float ypr[3];
void setup(){
Serial.begin(115200);
motion.begin();
motion.setFullScaleAccelRange(ACCEL_FS_4);
}
void loop(){
if(motion.get_data(MOTION_3, ypr)){
Serial.println(ypr[1]);
delay(100);
}
}
其他