Giter VIP home page Giter VIP logo

lis3mdl-arduino's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lis3mdl-arduino's Issues

Continuous-conversion mode outputs the same value

Hi!

I have an issue using LIS3MDL and Arduino library. I compiled and ran your "Serial" example, but instead of getting real-time values I receive the same value of X/Y/Z readings on every loop iteration. When I reset my Arduino, then I get a new value, but just once. I mean:

Serial output:

X1 Y1 Z1
X1 Y1 Z1
...
ARDUINO RESET
X2 Y2 Z2
X2 Y2 Z2
...

When I take "mag.enableDefault()" from setup() to loop() and I change "writeReg(CTRL_REG3, 0x00)" to "writeReg(CTRL_REG3, 0x01)" in "void LIS3MDL::enableDefault(void)" then I have a real-time reading, but hey - why should I configure device in the loop? Any ideas?

read() could be reading garbled data since sensor updates them synchronously to DRDY

As far as I understand the LIS3MDL, it repeatedly measures the magnetic field and updates the magnetometer data registers. The DRDY bit goes high when all of x,y,z have been updated, and after that, the sensor pauses a finite time (according to the data rate) before taking a new measurement (in continuous mode.) An app reading the mag data should do so just after DRDY goes high, else the app could read the data while it was being changed by the device (i.e. it could be garbled?) So an app should poll the DRDY bit in the status register (using readReg()). Reading the X high byte clears DRDY bit. In other words, calls to read() should be synchronized to the DRDY bit going high. Is that a correct assessment?

how do you convert the values to a compass heading?

please give an example of how to convert the values to a compass heading, i have tried

float Heading = 180*atan2( mag.m.y, mag.m.z)/PI;

but it just gives me a heading from 300 to 200 no matter how the compass is orientated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.