getRawValues()
描述
取得六軸慣性感測器的原始數據。
語法
FreeIMU1.getRawValues(raw_values)
參數
FreeIMU1:FreeIMU1 型別的變數
raw_values:raw_values 是一個指向整數陣列的指標,該陣列應該至少有可以存放六個整數元素的空間。在 getRawValues() 執行完後,該陣列會依序存放加速度計 X,Y,Z 軸的原始數據及陀螺儀 X,Y,Z 軸的原始數據
回傳
無
範例
#include <FreeIMU1.h>
#include <Wire.h>
FreeIMU1 myIMU;
void setup()
{
Serial.begin(115200);
Wire.begin();
delay(500);
myIMU.init();
delay(500);
}
void loop()
{
int raw_values[6];
char str[512];
myIMU.getRawValues(raw_values);
sprintf(str, "%d\t%d\t%d\t%d\t%d\t%d\t",
raw_values[0], raw_values[1], raw_values[2],
raw_values[3], raw_values[4], raw_values[5]);
Serial.print(str);
Serial.print('\n');
delay(20);
}
See also
- getValues()
The text of the 86Duino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.
