You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Redistribution and use in source and binary forms, with or without
15
+
* modification, are permitted provided that the following conditions are met:
16
+
*
17
+
* Redistributions of source code must retain the above copyright
18
+
* notice, this list of conditions and the following disclaimer.
19
+
*
20
+
* Redistributions in binary form must reproduce the above copyright
21
+
* notice, this list of conditions and the following disclaimer in the
22
+
* documentation and/or other materials provided with the distribution.
23
+
*
24
+
* Neither the name of the copyright holder nor the names of the
25
+
* contributors may be used to endorse or promote products derived from
26
+
* this software without specific prior written permission.
27
+
*
28
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
29
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31
+
* DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
32
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
33
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
38
+
*
39
+
* The information provided is believed to be accurate and reliable.
40
+
* The copyright holder assumes no responsibility for the consequences of use
41
+
* of such information nor for any infringement of patents or
42
+
* other rights of third parties which may result from its use.
43
+
* No license is granted by implication or otherwise under any patent or
44
+
* patent rights of the copyright holder.
45
+
*/
46
+
47
+
#include"NAxisMotion.h"//Contains the bridge code between the API and the Arduino Environment
48
+
#include<Wire.h>
49
+
50
+
NAxisMotion mySensor; //Object that for the sensor
51
+
unsignedlong lastStreamTime = 0; //To store the last streamed time stamp
52
+
constint streamPeriod = 40; //To stream at 25Hz without using additional timers (time period(ms) =1000/frequency(Hz))
53
+
bool updateSensorData = true; //Flag to update the sensor data. Default is true to perform the first read before the first stream
54
+
55
+
voidsetup() //This code is executed once
56
+
{
57
+
//Peripheral Initialization
58
+
Serial.begin(115200); //Initialize the Serial Port to view information on the Serial Monitor
59
+
I2C.begin(); //Initialize I2C communication to the let the library communicate with the sensor.
60
+
//Sensor Initialization
61
+
mySensor.initSensor(); //The I2C Address can be changed here inside this function in the library
62
+
mySensor.setOperationMode(OPERATION_MODE_NDOF); //Can be configured to other operation modes as desired
63
+
mySensor.setUpdateMode(MANUAL); //The default is AUTO. Changing to manual requires calling the relevant update functions prior to calling the read functions
64
+
//Setting to MANUAL requires lesser reads to the sensor
0 commit comments