MicroView Digital Compass

Contributors: AGlass0fMilk
Favorited Favorite 5

Understanding and Running the Sketch

In the beginning of the code, you will see a lot of the word PROGMEM. Since this sketch uses a lot of sprites, the regular memory couldn't hold all of them. This keyword is part of a library that lets you store certain variables in memory.

The rest of the code follows the example calibration sketch for the MAG3110 Library. If you want to know more about calibrating the MAG3110, see the hookup guide linked to earlier. The heading I get from this I had to offset by 90 degrees since the MicroView and the MAG31110 x-axis were pointing in different directions.

When you first start running the sketch, you will need to calibrate the MAG3110 by spinning it 360 degrees a few times while keeping it level.

Based on the heading, the code loads a different sprite onto the MicroView.

Compass GIF

Once calibrated, you should have a working digital compass!