Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions examples/magic_wand/imu_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#define MAGIC_WAND_IMU_PROVIDER_H

#include <Arduino_LSM9DS1.h>
#ifdef NANO33_BLE_REV2
#include <Arduino_BMI270_BMM150.h>
#endif

#include <ArduinoBLE.h>

namespace {
Expand Down Expand Up @@ -60,15 +64,15 @@ 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];
// Read each sample, removing it from the device's FIFO buffer
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;

Expand All @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions examples/magic_wand/magic_wand.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ limitations under the License.

#include <TensorFlowLite.h>

// 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"
Expand Down
4 changes: 4 additions & 0 deletions examples/test_IMU/test_IMU.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/

#include <Arduino_LSM9DS1.h>
// if using Nano BLE rev2, uncomment next line
// #include <Arduino_BMI270_BMM150.h>

int imuIndex = 0; // 0 - accelerometer, 1 - gyroscope, 2 - magnetometer
bool commandRecv = false; // flag used for indicating receipt of commands from serial port
Expand All @@ -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");
Expand Down