// // hello.TLE493D.RP2040.ino // // Hall effect vector serial hello-world // Dependency: XENSIV 3D Magnetic Sensor TLx493D Arduino Library // // Quentin Bolsee 3/15/2026 // // This work may be reproduced, modified, distributed, // performed, and displayed for any purpose, but must // acknowledge this project. Copyright is retained and // must be preserved. The work is provided as is; no // warranty is provided, and users accept all liability. // #include "TLx493D_inc.hpp" #define LAMBDA (0.98) using namespace ifx::tlx493d; TLx493D_A2B6 dut(Wire, TLx493D_IIC_ADDR_A0_e); void setup() { Serial.begin(0); Wire.setClock(1000000); delay(10); dut.begin(); dut.setSensitivity(TLx493D_FULL_RANGE_e); } double mx = 0.0; double my = 0.0; void loop() { double t, x, y, z; dut.getMagneticField(&x, &y, &z); mx = mx * LAMBDA + x * (1.0-LAMBDA); my = my * LAMBDA + y * (1.0-LAMBDA); if (Serial.available()) { Serial.read(); Serial.printf("%.4f %.4f \n", mx, my); } }