How do I set up the heading for an Inertial Sensor?

Please, take a look at these examples:

Let us know if you could get started initializing and using inertial sensor. After you you do, the next step would be to add PID to control your turns using inertial sensor as the input.

Yes rotation() is the correct function to call, you just need to remember its initial value before entering PID loop (see example here).

Even more information here: Inertial sensor programming - #7 by weilin

6 Likes