Skip to content

Commit 40b247d

Browse files
committed
Small changes
1 parent 269c80a commit 40b247d

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

examples/magic_wand/imu_provider.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#ifndef MAGIC_WAND_IMU_PROVIDER_H
22
#define MAGIC_WAND_IMU_PROVIDER_H
33

4-
#include <Arduino_LSM9DS1.h>
54
#ifdef NANO33_BLE_REV2
65
#include <Arduino_BMI270_BMM150.h>
6+
#else
7+
#include <Arduino_LSM9DS1.h>
78
#endif
89

910
#include <ArduinoBLE.h>
@@ -72,7 +73,6 @@ namespace {
7273
if (!IMU.readGyroscope(
7374
current_gyroscope_data[0], current_gyroscope_data[1], current_gyroscope_data[2])) {
7475
Serial.println("Failed to read gyroscope data");
75-
//break;
7676
}
7777
*new_gyroscope_samples += 1;
7878

@@ -83,7 +83,6 @@ namespace {
8383
if (!IMU.readAcceleration(
8484
current_acceleration_data[0], current_acceleration_data[1], current_acceleration_data[2])) {
8585
Serial.println("Failed to read acceleration data");
86-
//break;
8786
}
8887
*new_accelerometer_samples += 1;
8988
}
@@ -93,7 +92,7 @@ namespace {
9392
// Keep track of whether we stored any new data
9493
int new_samples = 0;
9594
// Loop through new samples and add to buffer
96-
while (IMU.gyroscopeAvailable()) {
95+
if (IMU.gyroscopeAvailable()) {
9796
const int index = (gyroscope_data_index % gyroscope_data_length);
9897
gyroscope_data_index += 3;
9998
float* data = &gyroscope_data[index];

examples/magic_wand/magic_wand.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ limitations under the License.
1212

1313
#include <TensorFlowLite.h>
1414

15-
// if using Nano BLE rev2, uncomment next line
15+
// If you are using a Nano BLE rev2, uncomment the next line:
1616
// #define NANO33_BLE_REV2
1717

1818
#include "tensorflow/lite/micro/micro_error_reporter.h"
@@ -66,6 +66,8 @@ namespace {
6666
void setup() {
6767
// Start serial
6868
Serial.begin(9600);
69+
while (!Serial);
70+
6971
Serial.println("Started");
7072

7173
// Start IMU

examples/test_IMU/test_IMU.ino

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
Requires the Arduino_LSM9DS1 library library
77
*/
88

9+
// If you are using a Nano BLE rev2, uncomment the next line:
10+
// #define NANO33_BLE_REV2
11+
12+
#ifdef NANO33_BLE_REV2
13+
#include <Arduino_BMI270_BMM150.h>
14+
#else
915
#include <Arduino_LSM9DS1.h>
10-
// if using Nano BLE rev2, uncomment next line
11-
// #include <Arduino_BMI270_BMM150.h>
16+
#endif
1217

1318
int imuIndex = 0; // 0 - accelerometer, 1 - gyroscope, 2 - magnetometer
1419
bool commandRecv = false; // flag used for indicating receipt of commands from serial port

0 commit comments

Comments
 (0)