Hello!
I'm currently working on a 3d printed joystick using a 3-axis magnetometer for positions sensing.
I setup everything according to instructions I found on sparkfun:
(Qwiic Magnetometer (MLX90393) Hookup Guide - SparkFun Learn)
But I'm unable to get any data from the breakout module.
The Leonardo is unable to get past line 50 "mlx.readData(data);".
Here's "my" code:
/*
/*
3.3V = 3.3V
GND = GND
SDA = D2
SCL = D3
*/
#include <Wire.h>
#include <MLX90393.h>
MLX90393 mlx;
MLX90393::txyz data; //Create a structure, called data, of four floats (t, x, y, and z)
void setup()
{
Serial.begin(9600);
Serial.println("19");
Serial.println("MLX90393 Read Example");
Serial.println("21");
Wire.begin();
Serial.println("23");
//Connect to sensor with I2C address jumpers set: A1 = 1, A0 = 0
//Use DRDY pin connected to A3
//Returns byte containing status bytes
byte status = mlx.begin(1, 0, A3);
Serial.println("28");
delay(2000);
Serial.println("30");
//Report status from configuration
Serial.print("Start status: 0x");
if (status < 0x10) Serial.print("0"); //Pretty output
Serial.println(status, BIN);
Serial.println("36");
mlx.setGainSel(1);
mlx.setResolution(0, 0, 0); //x, y, z
mlx.setOverSampling(0);
mlx.setDigitalFiltering(0);
Serial.println("42");
//See MLX90393.h and .cpp for additional functions including:
//set/getOverSample, set/getTemperatureOverSample, set/getDigitalFiltering, set/getResolution
//set/getTemperatureCompensation, setOffsets, setWThresholds
}
void loop()
{
Serial.println("50");
mlx.readData(data); //Read the values from the sensor
Serial.println("52");
Serial.print("magX[");
Serial.println("54");
Serial.print(data.x);
Serial.println("56");
Serial.print("] magY[");
Serial.println("58");
Serial.print(data.y);
Serial.println("60");
Serial.print("] magZ[");
Serial.println("62");
Serial.print(data.z);
Serial.println("64");
Serial.print("] temperature(C)[");
Serial.println("66");
Serial.print(data.t);
Serial.println("68");
//Serial.print("] status[");
//Serial.print(status);
Serial.print("]");
Serial.println("72");
Serial.println();
delay(100);
}
Serial monitor outputs this:
""30
Start status: 0x11111111
36
42
50
""
Things I'v already tried:
->I switched from the Leonardo to an UNO but I got the same result
->I2C Scanner finds the breakout module
"Scanning...
I2C device found at address 0x0D !
done"
->used an external power supply to power the breakout module (at 3.3V)
I've never worked with I2C before and I have no idea what isn't working.
It would be really nice if anybody could help me.

