getValues()
描述
取得六軸感測器經由偏移量校正後的數值。
語法
FreeIMU1.getValues(values)
參數
FreeIMU1
:FreeIMU1
型別的變數
values
:values
是一個指向浮點數陣列或雙精度浮點數陣列的指標,該陣列應該至少有可以存放六個浮點數或雙精度浮點數元素的空間。在 getValues()
執行完後,該陣列內容會依序存放加速度計 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() { double values[6]; char str[512]; myIMU.getValues(values); sprintf(str, "%f\t%f\t%f\t%f\t%f\t%f\t", values[0], values[1], values[2], values[3], values[4], values[5]); Serial.print(str); Serial.print('\n'); delay(20); }
See also
- getRawValues()
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.