Try that code, after calibrating the gyro.
If you are a beginner, you simply cannot expect to jump into an advanced project like this without doing a lot of work learning the basics, including some college-level mathematics.
Otherwise, post on the Jobs and Paid Collaborations forum section. You might be asked to pay for the help.