“SensorMotion.begin()”的版本间的差异

来自Microduino Wikipedia
跳转至: 导航搜索
 
(未显示同一用户的4个中间版本)
第13行: 第13行:
 
*'''例子''':这里以硬串口通讯为例<br>
 
*'''例子''':这里以硬串口通讯为例<br>
 
<pre style="color:green">
 
<pre style="color:green">
#include <sensor_motion.h>
+
#include <Sensor_Motion.h>
  
 
sensorMotion motion(&Serial1);
 
sensorMotion motion(&Serial1);
  
 
void setup(){
 
void setup(){
::motion.begin();
+
    motion.begin();
 
}
 
}
  
第27行: 第27行:
 
</pre>
 
</pre>
  
 +
*'''例子''':这里以软串口通讯为例<br>
 +
<pre style="color:green">
 +
#include <Sensor_Motion.h>
  
 +
SoftwareSerial mySerial(2, 3); // RX, TX
 +
sensorMotion motion(&mySerial);
 +
 +
void setup(){
 +
    motion.begin();
 +
}
 +
 +
void loop(){
 +
}
 +
 +
 +
</pre>
 +
<br>
 +
<p style="color: #E87E05;font-size:135%">其他</p>
 +
*[[sensorMotion()]]
 +
*[[sensorMotion.getData()|getData()]]
 +
*[[sensorMotion.setFullScaleGyroRange()|setFullScaleGyroRange()]]
 +
*[[sensorMotion.setFullScaleAccelRange()|setFullScaleAccelRange()]]
 +
 +
<br>
 
[[https://wiki.microduino.cn/index.php/Sensor-Motion/zh 返回Sensor_Motion语法手册]]
 
[[https://wiki.microduino.cn/index.php/Sensor-Motion/zh 返回Sensor_Motion语法手册]]

2017年7月27日 (四) 03:36的最新版本

sensorMotion.begin()

  • 作用:

Sensor_Motion库的初始化函数,可以自动配置Sensor_Motion传感器的串口波特率。


  • 参数:无


  • 例子:这里以硬串口通讯为例
#include <Sensor_Motion.h>

sensorMotion motion(&Serial1);

void setup(){
    motion.begin();
}

void loop(){
}


  • 例子:这里以软串口通讯为例
#include <Sensor_Motion.h>

SoftwareSerial mySerial(2, 3); // RX, TX
sensorMotion motion(&mySerial);

void setup(){
    motion.begin();
}

void loop(){
}



其他


[返回Sensor_Motion语法手册]