LED compass

    Magnetic fields have both a magnitude, measured in Gauss or Teslas, and a direction. Themagnetometer on the F3 measures both the magnitude and the direction of an external magnetic fieldbut it reports back the decomposition of said field along its axes.

    See below, the magnetometer has three axes associated to it.

    Only the X and Y axes are shown above. The Z axis is pointing “out” of your screen.

    Let’s get familiar with the readings of the magnetometer by running the following starter code:

    Locate where north is at your current location. Then rotate the board such that it’s aligned“towards north”: the North LED (LD3) should be pointing towards north.

    Now run the starter code and observe the output. What X, Y and Z values do you see?