init()
描述
初始化 FreeIMU1 物件
語法
FreeIMU1.init()
FreeIMU1.init(fastmode)
參數
FreeIMU1:FreeIMU1 型別的變數
fastmode:型態為 bool,如果為 TRUE,則將 I2C Bus 設定成 400Kbps 快速模式來存取感測器,反之則以 100Kbps 標準速度模式存取感測器
回傳
無
範例
#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);
}
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.
