I've bought a Nano BLE rev 2 to test it after using the rev 1 successfully.
With Nano rev 1 and LSMDS1 sensor my code with magdwick filter, BT and scheduler runs perfectly but with rev 2 and BMI270 BMM150 new sensors, the sensor's values are all 0.
So I tried to simulate my code with following example modified with two loops and the scheduler. The first loop with about the time necessary for the loop 1 of original code and the behaviour is very similar.
Setting opportunely the library to include, the Nano rev 1 runs correctly instead the rev 2 not.
Please, someone can tell me where I wrong?
Both IDE 1.8.19 / 2.3.2and last library revision available, and Arduino Emb OS edge 4.1.1.
#include <Scheduler.h>
//#include <Arduino_LSM9DS1.h> // use for Nano BLE rev1
#include <Arduino_BMI270_BMM150.h> // use for Nano BLE rev2
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("Started");
if (!IMU.begin()) {
Serial.println("Failed to initialize IMU!"); // Check for Nano BLE revision
while (1);
}
Scheduler.startLoop(loop2);
}
// START LOOP1 OF PROGRAM
void loop() {
delay(300); // to simulate other code running slowly
yield(); // close loop to move to other
}
// END LOOP1 OF PROGRAM
// START LOOP2 OF PROGRAM
void loop2()
{
float x, y, z;
if (IMU.accelerationAvailable()) {
IMU.readAcceleration(x, y, z);
Serial.print(x);
Serial.print('\t');
Serial.print(y);
Serial.print('\t');
Serial.println(z);
}
yield(); // close loop to move to other
}// END LOOP2 OF PROGRAM