User Tools

Site Tools


arduino:hmc5983

This is an old revision of the document!


HMC5983

magnetmeter

#include <HMC5983.h>
#include <Wire.h>
 
HMC5983 compass;
 
void setup () {
   Wire.begin(23, 19); //I2C setup
  Serial.begin(115200);
  compass.begin(true); // use "true" if you need some debug information
}
 
void loop() {
  float c = -999;
  c = compass.read();
  if (c == -999) {
    Serial.println("Reading error, discarded");
  } else Serial.println(c);
  //delay(500);
}
arduino/hmc5983.1577032116.txt.gz · Last modified: by aistis