9 Replies Latest reply on Jun 8, 2017 3:13 AM by c2

    Arduino library for SparkFun 9DOF Block with edison

    c2

      Hello,

       

      I had a question regarding using the arduino library for sparkfun 9dof block with edison. This is the library I am using: https://github.com/sparkfun/SparkFun_LSM9DS0_Arduino_Library

       

      I am using Arduino 1.6 and followed Re: Arduino Library for SparkFun Block 9 Degrees of Freedom and changed the LINUX_I2C_ADAPTER value. I am able to get the sensor values printed when I run the Sparkfun_LSM9DS0_Simple.ino example.

       

      I am now trying to get the sensor values only when new values are available by using the 3 interrupts (INT1XM, INT2XM and DRDYG). I changed the pins to the following:

       

      const byte INT1XM = 48; // INT1XM tells us when accel data is ready

      const byte INT2XM = 49; // INT2XM tells us when mag data is ready

      const byte DRDYG  = 47; // DRDYG  tells us when gyro data is ready

       

      But the interrupts are not working properly. When I print the interrupt values, I am getting -1. I did not solder anything on the 9dof block board itself. Should I solder anything?

      Can someone tell me what I might be doing wrong?

       

      I have pasted my code below:

       

      #include <SPI.h> // Included for SFE_LSM9DS0 library

      #include <Wire.h>

      #include <SFE_LSM9DS0.h>

      #define LSM9DS0_XM  0x1D // Would be 0x1E if SDO_XM is LOW

      #define LSM9DS0_G   0x6B // Would be 0x6A if SDO_G is LOW

      // Create an instance of the LSM9DS0 library called `dof` the

      // parameters for this constructor are:

      // [SPI or I2C Mode declaration],[gyro I2C address],[xm I2C add.]

      LSM9DS0 dof(MODE_I2C, LSM9DS0_G, LSM9DS0_XM);

       

      #define INT1XM 48

      #define INT2XM 49

      #define DRDYG  47

       

      void setup()

      {

          Serial.begin(115200);

         pinMode(INT1XM, INPUT);

         pinMode(INT2XM, INPUT);

         pinMode(DRDYG,  INPUT);

         uint16_t status = dof.begin(dof.G_SCALE_245DPS,dof.A_SCALE_2G, dof.M_SCALE_2GS,dof.G_ODR_95_BW_125,dof.A_ODR_100,dof.M_ODR_3125);

         Serial.print("LSM9DS0 WHO_AM_I's returned: 0x");

        Serial.println(status, HEX);

        Serial.println("Should be 0x49D4");

         delay(2000);

         Serial.println("done");

      }

       

      void loop()

      {

        Serial.print("Magnetometer INT2XM: ");

        Serial.println(digitalRead(INT2XM));

        Serial.print("Accel  INT1XM: ");

        Serial.println(digitalRead(INT1XM));

        Serial.print("Gyro DRDYG: ");

        Serial.println(digitalRead(DRDYG));

      }

       

      Output:

      LSM9DS0 WHO_AM_I's returned: 0x49D4

      Should be 0x49D4

      done

      Magnetometer INT2XM: -1

      Accel  INT1XM: -1

      Gyro DRDYG: -1

      Magnetometer INT2XM: -1

      Accel  INT1XM: -1

      Gyro DRDYG: -1

      Magnetometer INT2XM: -1

      Accel  INT1XM: -1

      Gyro DRDYG: -1

      Magnetometer INT2XM: -1

      Accel  INT1XM: -1

      Gyro DRDYG: -1

       

      Any help is greatly appreciated!

       

      Thanks!