Skip to content

Commit 1c74c1e

Browse files
authored
Merge pull request #1 from marqdevx/fixV2
Fix v1.1.1
2 parents 4443e77 + bbede03 commit 1c74c1e

File tree

7 files changed

+93
-71
lines changed

7 files changed

+93
-71
lines changed

examples/Accelerometer/Accelerometer.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ bool updateSensorData = true; //Flag to update the sensor data. Default
5555
void setup() //This code is executed once
5656
{
5757
//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.
58+
Serial.begin(9600); //Initialize the Serial Port to view information on the Serial Monitor
59+
Wire.begin(); //Initialize I2C communication to the let the library communicate with the sensor.
6060
//Sensor Initialization
6161
mySensor.initSensor(); //The I2C Address can be changed here inside this function in the library
6262
mySensor.setOperationMode(OPERATION_MODE_NDOF); //Can be configured to other operation modes as desired

examples/BareMinimum/BareMinimum.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ NineAxesMotion mySensor; //Object that for the sensor
5252
void setup() //This code is executed once
5353
{
5454
//Peripheral Initialization
55-
I2C.begin(); //Initialize I2C communication to the let the library communicate with the sensor.
55+
Wire.begin(); //Initialize I2C communication to the let the library communicate with the sensor.
5656
//Sensor Initialization
5757
mySensor.initSensor(); //The I2C Address can be changed here inside this function in the library
5858
mySensor.setOperationMode(OPERATION_MODE_NDOF); //Can be configured to other operation modes as desired

examples/Euler/Euler.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ const int streamPeriod = 20; //To stream at 50Hz without using addition
5454
void setup() //This code is executed once
5555
{
5656
//Peripheral Initialization
57-
Serial.begin(115200); //Initialize the Serial Port to view information on the Serial Monitor
58-
I2C.begin(); //Initialize I2C communication to the let the library communicate with the sensor.
57+
Serial.begin(9600); //Initialize the Serial Port to view information on the Serial Monitor
58+
Wire.begin(); //Initialize I2C communication to the let the library communicate with the sensor.
5959
//Sensor Initialization
6060
mySensor.initSensor(); //The I2C Address can be changed here inside this function in the library
6161
mySensor.setOperationMode(OPERATION_MODE_NDOF); //Can be configured to other operation modes as desired

examples/Motion/Motion.ino

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

48-
#include "NineAxesMotion.h" //Contains the bridge code between the API and the Arduino Environment
48+
#include "NineAxesMotion.h" //Contains the bridge code between the API and the Arduino Environment
4949
#include <Wire.h>
5050

51-
NineAxesMotion mySensor; //Object that for the sensor
52-
bool intDetected = false; //Flag to indicate if an interrupt was detected
53-
int threshold = 5; //At a Range of 4g, the threshold is set at 39.05mg or 0.3830m/s2. This Range is the default for NDOF Mode
54-
int duration = 1; //At a filter Bandwidth of 62.5Hz, the duration is 8ms. This Bandwidth is the default for NDOF Mode
55-
bool anyMotion = true; //To know which interrupt was triggered
51+
NineAxesMotion mySensor; //Object that for the sensor
52+
bool intDetected = false; //Flag to indicate if an interrupt was detected
53+
int threshold = 5; //At a Range of 4g, the threshold is set at 39.05mg or 0.3830m/s2. This Range is the default for NDOF Mode
54+
int duration = 1; //At a filter Bandwidth of 62.5Hz, the duration is 8ms. This Bandwidth is the default for NDOF Mode
55+
bool anyMotion = true; //To know which interrupt was triggered
56+
57+
int InterruptPin = 2; // Pin D2 is connected to the INT LED
5658

5759
void setup() //This code is executed once
5860
{
5961
//Peripheral Initialization
60-
Serial.begin(115200); //Initialize the Serial Port to view information on the Serial Monitor
61-
I2C.begin(); //Initialize I2C communication to the let the library communicate with the sensor.
62+
Serial.begin(9600); //Initialize the Serial Port to view information on the Serial Monitor
63+
Wire.begin(); //Initialize I2C communication to the let the library communicate with the sensor.
6264
//Sensor Initialization
6365
Serial.println("Please wait. Initialization in process.");
64-
mySensor.initSensor(); //The I2C Address can be changed here inside this function in the library
65-
mySensor.setOperationMode(OPERATION_MODE_NDOF); //Can be configured to other operation modes as desired
66-
mySensor.setUpdateMode(MANUAL); //The default is AUTO. Changing to manual requires calling the relevant update functions prior to calling the read functions
66+
mySensor.initSensor(); //The I2C Address can be changed here inside this function in the library
67+
mySensor.setOperationMode(OPERATION_MODE_NDOF); //Can be configured to other operation modes as desired
68+
mySensor.setUpdateMode(MANUAL); //The default is AUTO. Changing to manual requires calling the relevant update functions prior to calling the read functions
6769
//Setting to MANUAL requires lesser reads to the sensor
6870

69-
attachInterrupt(INT_PIN, motionISR, RISING); //Attach the interrupt to the Interrupt Service Routine for a Rising Edge. Change the interrupt pin depending on the board
71+
72+
attachInterrupt(digitalPinToInterrupt(InterruptPin), motionISR, RISING); //Attach the interrupt to the Interrupt Service Routine for a Rising Edge. Change the interrupt pin depending on the board
7073

7174
//Setup the initial interrupt to trigger at No Motion
7275
mySensor.resetInterrupt();
7376
mySensor.enableSlowNoMotion(threshold, duration, NO_MOTION);
7477
anyMotion = false;
75-
mySensor.accelInterrupts(ENABLE, ENABLE, ENABLE); //Accelerometer interrupts can be triggered from all 3 axes
78+
mySensor.accelInterrupts(ENABLE, ENABLE, ENABLE); //Accelerometer interrupts can be triggered from all 3 axes
7679
Serial.println("This is a game to test how steady you can move an object with one hand. \nKeep the device on a table and mark 2 points.");
7780
Serial.println("Move the Device from one place to another without triggering the Any Motion Interrupt.\n\n");
7881
delay(1000); //Delay for the player(s) to read
@@ -88,18 +91,18 @@ void loop() //This code is looped forever
8891
{
8992
Serial.println("You moved!! Try again. Keep the Device at one place.\n");
9093
intDetected = false;
91-
mySensor.resetInterrupt(); //Reset the interrupt line
92-
mySensor.disableAnyMotion(); //Disable the Any motion interrupt
93-
mySensor.enableSlowNoMotion(threshold, duration, NO_MOTION); //Enable the No motion interrupt (can also use the Slow motion instead)
94+
mySensor.resetInterrupt(); //Reset the interrupt line
95+
mySensor.disableAnyMotion(); //Disable the Any motion interrupt
96+
mySensor.enableSlowNoMotion(threshold, duration, NO_MOTION); //Enable the No motion interrupt (can also use the Slow motion instead)
9497
anyMotion = false;
9598
}
9699
else
97100
{
98101
Serial.println("Device is not moving. You may start again.\n\n\n");
99102
intDetected = false;
100-
mySensor.resetInterrupt(); //Reset the interrupt line
101-
mySensor.disableSlowNoMotion(); //Disable the Slow or No motion interrupt
102-
mySensor.enableAnyMotion(threshold, duration); //Enable the Any motion interrupt
103+
mySensor.resetInterrupt(); //Reset the interrupt line
104+
mySensor.disableSlowNoMotion(); //Disable the Slow or No motion interrupt
105+
mySensor.enableAnyMotion(threshold, duration); //Enable the Any motion interrupt
103106
anyMotion = true;
104107
}
105108
}
@@ -109,4 +112,4 @@ void loop() //This code is looped forever
109112
void motionISR()
110113
{
111114
intDetected = true;
112-
}
115+
}

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=9 Axes Motion
2-
version=1.1.0
2+
version=1.1.1
33
author=Bosch Sensortec GmbH
44
maintainer=Arduino <[email protected]>
55
sentence=Arduino 9 Axes Motion Shield Library

src/NineAxesMotion.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,18 @@
1515
*
1616
* Modified by: Arduino.org development Team.
1717
*
18-
****************************************************************************
18+
********************************************************************************************************************************************************
19+
*
20+
* Fixed Wire Class,
21+
* Changed Motion.ino example to be connected allways with the pin D2 and
22+
* fixed the interrupt attach function
23+
*
24+
* Date: 04/26/2021
25+
*
26+
* Modified by: Pablo Marquínez @ content team arduino.cc ([email protected])
27+
*
1928
/***************************************************************************
29+
*
2030
* License:
2131
*
2232
* Redistribution and use in source and binary forms, with or without

src/NineAxesMotion.h

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,17 @@
1616
* Modified by: Arduino.org development Team.
1717
*
1818
****************************************************************************
19+
*
20+
* Fixed Wire Class,
21+
* Changed Motion.ino example to be connected allways with the pin D2 and
22+
* fixed the interrupt attach function
23+
*
24+
* Date: 04/26/2021
25+
*
26+
* Modified by: Pablo Marquínez @ content team arduino.cc ([email protected])
27+
*
1928
/***************************************************************************
29+
*
2030
* License:
2131
*
2232
* Redistribution and use in source and binary forms, with or without
@@ -56,7 +66,6 @@
5666

5767

5868

59-
6069
extern "C" {
6170
#include <utility/BNO055.h>
6271
}

0 commit comments

Comments
 (0)