Me Compass is responding with a HMC5883L Connection Failed error


I added the Me Compass to Port 2, and I’m running the MeCompassTest program from my Arduino IDE. When the program starts, I’m getting a “HMC5883L Connection Failed” message and host a bunch of 2.0 readings in the serial monitor.

I tried pressing the button on the module to calibrate it but the blue light does not flash.

I also looked at the mBlock software but I do not see the compass sensor in there. I see screen shots of other people’s program with the sensor in it so I know it exists.

Any thoughts? Thanks.

This is my Arduino program to test the Me Compass:

#include “MeMCore.h”
#include <Wire.h>

MeCompass Compass(PORT_2);

void setup()
Serial.println(“Initializing I2C devices…”);
Serial.println(“Testing device connections…”);
Serial.println(Compass.testConnection() ? “HMC5883L connection successful” : “HMC5883L connection failed”);

void loop()
int16_t head_X, head_Y, head_Z;
double angle_number = 0;

head_X = Compass.getHeadingX();
head_Y = Compass.getHeadingY();
head_Z = Compass.getHeadingZ();

angle_number = Compass.getAngle();
Serial.println(angle_number, 1);


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.