Controlling robot according head movements using MPU-6050

Hi… I’m working on a project based on MPU-6050. I’m trying to control a robot using head movements. The MPU will be kept on the head. The problem is with the code. My code is working, but sometimes the Yaw pitch and roll data from the MPU gets stuck. Please refer my code and help. ASAP!!! I need to get it done before November 1.

Wheelchair_Code.ino (5.15 KB)

The MPU will be kept on the head.

The head of what?

Your serial output looks like?