Problem using MPU6050 with Joystick HID on Leonardo board

I’m trying to send MPU6050 x, y angle information into x and y axis USB joystick input.

I uses these 2 libraries.

#include <Joystick.h>
#include <MPU6050_tockn.h>

They don’t seem to work together.
I assume that serial monitor output is disable when USB HID is activated.
so there’s no serial monitor output. which is ok for my project.
But I can’t get any data from MPU6050 either when joystick HID is active.

here are my code.

#include <Joystick.h>
#include <MPU6050_tockn.h>
#include <Wire.h>

MPU6050 mpu6050(Wire);
Joystick_ Joystick;

void setup() {

Joystick.begin();
Wire.begin();
mpu6050.begin();
mpu6050.calcGyroOffsets(false);
}

void loop()
{

float x=mpu6050.getAngleX();
float y=mpu6050.getAngleY();

if (x>90) x=90;
else if (x<-90) x=-90;
if (y>90) y=90;
else if (y<-90) y=-90;

Joystick.setXAxis(map(x,-90,90, 0,1024));
Joystick.setYAxis(map(y, -90,90, 0, 1024));

delay(100);

}

Am I missing something?
Thanks for any help.

Pin

Please edit your post and insert code tags!

I assume that serial monitor output is disable when USB HID is activated.

No, but you don't write anything to the serial monitor.

But I can't get any data from MPU6050 either when joystick HID is active.

How do you know?

They don't seem to work together.

Did they work if you used them alone?

stupid me, forgot to put
mpu6050.update();
in the loop.
problem solved.
thanks for the help