Hardware Reference
In-Depth Information
Specifically, you'll need to change
#include <Adafruit_LSM303.h>
to
#in-
clude <Adafruit_LSM303_U.h>
. You'll also need to change
Ada-
fruit_LSM303_Mag mag = Adafruit_LSM303_Mag(12345);
to
Ada-
fruit_LSM303_Mag_Unified mag = Ada-
fruit_LSM303_Mag_Unified(12345);
.
When you upload and run this program, and open the
Serial Monitor
tab, you should see
the following screenshot:
Now, you have access to
Compass Heading
. The final step is to merge the NeoPixel
code with the
Compass Heading
code. The following is a simple example that
changes color based on the direction: