arduino-libraries / Arduino_LSM6DS3

LSM6DS3 Library for Arduino
GNU Lesser General Public License v2.1
31 stars 32 forks source link

[AE-199] Example sketches do not pass at IMU.begin() #40

Open aliphys opened 1 year ago

aliphys commented 1 year ago

I have compiled and uploaded the three following sketches, on two different laptops:

In all cases, the examples are compiled and uploaded without error. However, there is no output to the Serial monitor at all.

However, if Serial.println("Hello! 1") and Serial.println("Hello! 2") is added to the SimpleAccelerometer.ino sketch as follows:

void setup() {
  Serial.begin(9600);
  while (!Serial);
  Serial.println("Hello! 1");
  if (!IMU.begin()) {
    Serial.println("Failed to initialize IMU!");

    while (1);
  }
 Serial.println("Hello! 2");

  Serial.print("Accelerometer sample rate = ");
  Serial.print(IMU.accelerationSampleRate());
  Serial.println(" Hz");
  Serial.println();
  Serial.println("Acceleration in g's");
  Serial.println("X\tY\tZ");
}

Then only Serial.println("Hello! 1") is printed to the Serial monitor.

The latest version of the library 2640521 was used, with the following command in Windows.

arduino-cli compile -u -p COM7 --fqbn arduino:samd:nano_33_iot --library ".\"  ".\examples\SimpleGyroscope\SimpleGyroscope.ino"

I would expect the code to continue past !IMU.begin(), giving an error if it fails to initialise.

aliphys commented 1 year ago

Possibly related to

This issue also affects the tutorial for the Nano 33 IoT Accelerometer in the Docs website: https://github.com/arduino/docs-content/blob/main/content/hardware/03.nano/boards/nano-33-iot/tutorials/imu-accelerometer/content.md