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.