diff --git a/examples/magic_wand/imu_provider.h b/examples/magic_wand/imu_provider.h index a2d0cd5..15b9e0f 100644 --- a/examples/magic_wand/imu_provider.h +++ b/examples/magic_wand/imu_provider.h @@ -2,6 +2,10 @@ #define MAGIC_WAND_IMU_PROVIDER_H #include +#ifdef NANO33_BLE_REV2 +#include +#endif + #include namespace { @@ -60,7 +64,7 @@ namespace { *new_accelerometer_samples = 0; *new_gyroscope_samples = 0; // Loop through new samples and add to buffer - while (IMU.accelerationAvailable()) { + if (IMU.accelerationAvailable()) { const int gyroscope_index = (gyroscope_data_index % gyroscope_data_length); gyroscope_data_index += 3; float* current_gyroscope_data = &gyroscope_data[gyroscope_index]; @@ -68,7 +72,7 @@ namespace { if (!IMU.readGyroscope( current_gyroscope_data[0], current_gyroscope_data[1], current_gyroscope_data[2])) { Serial.println("Failed to read gyroscope data"); - break; + //break; } *new_gyroscope_samples += 1; @@ -79,7 +83,7 @@ namespace { if (!IMU.readAcceleration( current_acceleration_data[0], current_acceleration_data[1], current_acceleration_data[2])) { Serial.println("Failed to read acceleration data"); - break; + //break; } *new_accelerometer_samples += 1; } diff --git a/examples/magic_wand/magic_wand.ino b/examples/magic_wand/magic_wand.ino index 5c4e0de..4e89c1e 100644 --- a/examples/magic_wand/magic_wand.ino +++ b/examples/magic_wand/magic_wand.ino @@ -12,6 +12,9 @@ limitations under the License. #include +// if using Nano BLE rev2, uncomment next line +// #define NANO33_BLE_REV2 + #include "tensorflow/lite/micro/micro_error_reporter.h" #include "tensorflow/lite/micro/micro_interpreter.h" #include "tensorflow/lite/micro/micro_mutable_op_resolver.h" diff --git a/examples/test_IMU/test_IMU.ino b/examples/test_IMU/test_IMU.ino index 4b3d646..2148597 100644 --- a/examples/test_IMU/test_IMU.ino +++ b/examples/test_IMU/test_IMU.ino @@ -7,6 +7,8 @@ */ #include +// if using Nano BLE rev2, uncomment next line +// #include int imuIndex = 0; // 0 - accelerometer, 1 - gyroscope, 2 - magnetometer bool commandRecv = false; // flag used for indicating receipt of commands from serial port @@ -22,6 +24,8 @@ void setup() { while (1); } + IMU.setContinuousMode(); + Serial.println("Welcome to the IMU test for the built-in IMU on the Nano 33 BLE Sense\n"); Serial.println("Available commands:"); Serial.println("a - display accelerometer readings in g's in x, y, and z directions");