Skip to content

Commit 6aacbc5

Browse files
first commit
0 parents  commit 6aacbc5

13 files changed

+27616
-0
lines changed

.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Compiled Object files
2+
*.slo
3+
*.lo
4+
*.o
5+
*.obj
6+
7+
# Precompiled Headers
8+
*.gch
9+
*.pch
10+
11+
# Compiled Dynamic libraries
12+
*.so
13+
*.dylib
14+
*.dll
15+
16+
# Fortran module files
17+
*.mod
18+
19+
# Compiled Static libraries
20+
*.lai
21+
*.la
22+
*.a
23+
*.lib
24+
25+
# Executables
26+
*.exe
27+
*.out
28+
*.app
29+
30+
.DS_Store

LICENSE.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Copyright (C) 2011 - 2014 Bosch Sensortec GmbH
2+
3+
NAxisMotion Library
4+
Date: 2014/09/12
5+
Usage:Library and example code for the BNO055
6+
7+
License:
8+
9+
Redistribution and use in source and binary forms, with or without
10+
modification, are permitted provided that the following conditions are met:
11+
12+
Redistributions of source code must retain the above copyright
13+
notice, this list of conditions and the following disclaimer.
14+
15+
Redistributions in binary form must reproduce the above copyright
16+
notice, this list of conditions and the following disclaimer in the
17+
documentation and/or other materials provided with the distribution.
18+
19+
Neither the name of the copyright holder nor the names of the
20+
contributors may be used to endorse or promote products derived from
21+
this software without specific prior written permission.
22+
23+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26+
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
27+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
33+
34+
The information provided is believed to be accurate and reliable.
35+
The copyright holder assumes no responsibility for the consequences of use
36+
of such information nor for any infringement of patents or
37+
other rights of third parties which may result from its use.
38+
No license is granted by implication or otherwise under any patent or
39+
patent rights of the copyright holder.

README.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
NAxisMotion
2+
-----------
3+
The NAxisMotion.cpp and NAxisMotion.h files are C++ wrapper codes for the
4+
BNO055.c and BNO055.h Sensor API. The wrapper code has been designed to
5+
abstract the Sensor API and also to give an idea on how to use the
6+
advanced features in the Sensor API. Apart from that it acts a bridge
7+
between the Sensor API and the Arduino framework. Copy this library into
8+
"yourArduinoInstallation"/libraries folder.
9+
10+
11+
-------------------------------------------------------------------------------
12+
There are 4 examples with the NAxisMotion library.
13+
14+
- BareMinimum: This example code is as the name says the minimum code
15+
required to use the NAxisMotion sensor shield.
16+
17+
- Euler: This example code reads out the Euler angles in the NDoF mode to
18+
the Serial Monitor. It also reads out the Calibration Status. Each sensor
19+
and the System itself has its own Calibration Status. See below on how to
20+
calibrate each of the sensors.
21+
22+
- Accelerometer: This example code reads out the Accelerometer data and
23+
associated data which are the Linear Acceleration data, which is the
24+
Accelerometer data without the gravity vector, the other is the Gravity
25+
Acceleration data, which is only the gravity vector.
26+
27+
- Motion: This example code is a game to test how steadily you can move an
28+
object, in this case it is the shield with the Arduino board. The goal is
29+
to demonstrate on how to use the Any motion and No motion Interrupts.
30+
31+
Calibration helps the Sensor identify its environment and automatically
32+
determine offsets. Follow the instructions below to calibrate your sensor.
33+
34+
- Gyroscope: Keep it steady and do not move it. Preferably keep it on a fixed
35+
surface such as a table.
36+
37+
- Accelerometer: Rotate the shield slowly and pause at every 45deg for a
38+
second. Rotate one 1 axis at a time. Preferably rotate along 2 axes.
39+
40+
- Magnetometer: Move the magnetometer in a large 8 like pattern a few times
41+
gently.
42+
43+
+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
/****************************************************************************
2+
* Copyright (C) 2011 - 2014 Bosch Sensortec GmbH
3+
*
4+
* Accelerometer.ino
5+
* Date: 2014/09/09
6+
* Revision: 3.0 $
7+
*
8+
* Usage: Example code to stream Accelerometer data
9+
*
10+
****************************************************************************
11+
/***************************************************************************
12+
* License:
13+
*
14+
* 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+
unsigned long lastStreamTime = 0; //To store the last streamed time stamp
52+
const int 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+
void setup() //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
65+
mySensor.updateAccelConfig();
66+
updateSensorData = true;
67+
Serial.println();
68+
Serial.println("Default accelerometer configuration settings...");
69+
Serial.print("Range: ");
70+
Serial.println(mySensor.readAccelRange());
71+
Serial.print("Bandwidth: ");
72+
Serial.println(mySensor.readAccelBandwidth());
73+
Serial.print("Power Mode: ");
74+
Serial.println(mySensor.readAccelPowerMode());
75+
Serial.println("Streaming in ..."); //Countdown
76+
Serial.print("3...");
77+
delay(1000); //Wait for a second
78+
Serial.print("2...");
79+
delay(1000); //Wait for a second
80+
Serial.println("1...");
81+
delay(1000); //Wait for a second
82+
}
83+
84+
void loop() //This code is looped forever
85+
{
86+
if (updateSensorData) //Keep the updating of data as a separate task
87+
{
88+
mySensor.updateAccel(); //Update the Accelerometer data
89+
mySensor.updateLinearAccel(); //Update the Linear Acceleration data
90+
mySensor.updateGravAccel(); //Update the Gravity Acceleration data
91+
mySensor.updateCalibStatus(); //Update the Calibration Status
92+
updateSensorData = false;
93+
}
94+
if ((millis() - lastStreamTime) >= streamPeriod)
95+
{
96+
lastStreamTime = millis();
97+
98+
Serial.print("Time: ");
99+
Serial.print(lastStreamTime);
100+
Serial.print("ms ");
101+
102+
Serial.print(" aX: ");
103+
Serial.print(mySensor.readAccelX()); //Accelerometer X-Axis data
104+
Serial.print("m/s2 ");
105+
106+
Serial.print(" aY: ");
107+
Serial.print(mySensor.readAccelY()); //Accelerometer Y-Axis data
108+
Serial.print("m/s2 ");
109+
110+
Serial.print(" aZ: ");
111+
Serial.print(mySensor.readAccelZ()); //Accelerometer Z-Axis data
112+
Serial.print("m/s2 ");
113+
114+
Serial.print(" lX: ");
115+
Serial.print(mySensor.readLinearAccelX()); //Linear Acceleration X-Axis data
116+
Serial.print("m/s2 ");
117+
118+
Serial.print(" lY: ");
119+
Serial.print(mySensor.readLinearAccelY()); //Linear Acceleration Y-Axis data
120+
Serial.print("m/s2 ");
121+
122+
Serial.print(" lZ: ");
123+
Serial.print(mySensor.readLinearAccelZ()); //Linear Acceleration Z-Axis data
124+
Serial.print("m/s2 ");
125+
126+
Serial.print(" gX: ");
127+
Serial.print(mySensor.readGravAccelX()); //Gravity Acceleration X-Axis data
128+
Serial.print("m/s2 ");
129+
130+
Serial.print(" gY: ");
131+
Serial.print(mySensor.readGravAccelY()); //Gravity Acceleration Y-Axis data
132+
Serial.print("m/s2 ");
133+
134+
Serial.print(" gZ: ");
135+
Serial.print(mySensor.readGravAccelZ()); //Gravity Acceleration Z-Axis data
136+
Serial.print("m/s2 ");
137+
138+
Serial.print(" C: ");
139+
Serial.print(mySensor.readAccelCalibStatus()); //Accelerometer Calibration Status (0 - 3)
140+
141+
Serial.println();
142+
143+
updateSensorData = true;
144+
}
145+
}

examples/BareMinimum/BareMinimum.ino

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/****************************************************************************
2+
* Copyright (C) 2011 - 2014 Bosch Sensortec GmbH
3+
*
4+
* BareMinimum.ino
5+
* Date: 2014/08/25
6+
* Revision: 2.1 $
7+
*
8+
* Usage: Example code to describe the Bare Minimum
9+
*
10+
****************************************************************************
11+
/***************************************************************************
12+
* License:
13+
*
14+
* 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+
52+
void setup() //This code is executed once
53+
{
54+
//Peripheral Initialization
55+
I2C.begin(); //Initialize I2C communication to the let the library communicate with the sensor.
56+
//Sensor Initialization
57+
mySensor.initSensor(); //The I2C Address can be changed here inside this function in the library
58+
mySensor.setOperationMode(OPERATION_MODE_NDOF); //Can be configured to other operation modes as desired
59+
}
60+
61+
void loop() //This code is looped forever
62+
{
63+
//Blank
64+
}

0 commit comments

Comments
 (0)