Skip to content

Instantly share code, notes, and snippets.

@fxprime
Created March 7, 2025 07:07
Show Gist options
  • Save fxprime/3eefc0416625081e9a50517e073a9afc to your computer and use it in GitHub Desktop.
Save fxprime/3eefc0416625081e9a50517e073a9afc to your computer and use it in GitHub Desktop.
#include <Arduino.h>
#include <QMC5883LCompass.h>
/*
lib: mprograms/QMC5883LCompass @ ^1.2.3
*/
QMC5883LCompass compass;
void setup() {
Serial.begin(115200);
compass.init();
}
void loop() {
int a;
// Read compass values
compass.read();
// Return Azimuth reading
a = compass.getAzimuth();
Serial.print("A: ");
Serial.print(a);
Serial.println();
delay(250);
}
/*
A: 142
A: 144
A: 142
A: 144
A: 141
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment