Adafruit BNO055 getting stuck

I am using the official adafruit bno055 imu for my project. I started using the example code to get euler angles from the bno. The issue is that the imu gives data for a few seconds and then starts giving 0. Below is my code and output. Please help with this.

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>

// Create the BNO055 object
Adafruit_BNO055 bno = Adafruit_BNO055(55, 0x28); // default I2C address is 0x28 or 0x29

//HardwareSerial Serial4(PC11,PC10);

void setup() {
  Serial.begin(115200);
  while (!Serial);

  Serial.println("BNO055 Absolute Orientation Test");

  if (!bno.begin()) {
    Serial.println("Failed to initialize BNO055! Check connections.");
    while (1);
  }

  delay(1000);
  bno.setExtCrystalUse(true);  // use external crystal for better accuracy
}

void loop() {
  // Get absolute orientation as Euler angles (in degrees)
  imu::Vector<3> euler = bno.getVector(Adafruit_BNO055::VECTOR_EULER);

  Serial.print(euler.y());
  Serial.print(",");
  Serial.println(euler.z());
  delay(10);

}```

0.00,0.00
0.00,0.00
0.00,0.00
0.00,0.00
0.00,0.00
0.00,0.00

Try one or more of the seven examples. If they do not work you have a wiring error. If they do, then your code is wrong. Learn from the examples.

The example code works fine. But the example is also using the same library. I have soldered the connections so the wires cant be lose. I am not able to understand why this library code stops working.

You have it backwards. If the examples work then we know the library code is ok (as expected) That means it is your code. I don't have your sensors so can't do more.
Good luck.

Hi, are you still working on this? Is there any solution? Cause I am also facing the same problem

Hi !
One of the issues I found was that the sensor was not getting enough current. Also, I just started using the example code. The example code was working fine.