Having spent the last two months struggling with setting up this magnetometer, I figured I should put my findings together to help anyone else who is also trying to use these devices together.
Code #
void setup() {
Serial.begin(115200);
while(!Serial);
Tlv493dMagnetic3DSensor.begin();
Tlv493dMagnetic3DSensor.setAccessMode(Tlv493dMagnetic3DSensor.FASTMODE);
Tlv493dMagnetic3DSensor.enableInterrupt();
// the interrupt is indicated with a short(1.5 us) low pulse on SCL when new results are ready to read
Wire.setClock(1000000);
// Set I2C clock speed to 1MHz (Fast Mode Plus)
Tlv493dMagnetic3DSensor.disableTemp();
pinMode(INTERRUPT_PIN, INPUT);
// sets the interrupt pin 2 as input
pinMode(22, INPUT);
// sets the SCL pin 22 as input
attachInterrupt(digitalPinToInterrupt(INTERRUPT_PIN), onRead, FALLING);
// not sure whether to use LOW or FALLING
}
Published