Shop OBEX P1 Docs P2 Docs Learn Events
lsm9ds1 IMU get tilt along specified axis returns error: ...'__imuS' undeclared (first use) — Parallax Forums

lsm9ds1 IMU get tilt along specified axis returns error: ...'__imuS' undeclared (first use)

Howdy,

Looks like the built code for this LSM9DS1 sensor includes an undeclared variable, '__imuS ' when compiling with BlocklyProp. It gives an error when trying to use the LSM9DS1 IMU's: "gets tilt along specified axis" command...

BlocklyCodeImage-IMU-Tilt-Error.jpeg

Error:
Required libraries: lsm9ds1, simpletools
Library compile order: None needed
single.c: In function 'main':
single.c:29:28: error: '__imuS' undeclared (first use in this function)
single.c:29:28: note: each undeclared identifier is reported only once for each function it appears in

C code created:
/* SERIAL_TERMINAL USED */
// ------ Libraries and Definitions ------
#include "simpletools.h"
#include "lsm9ds1.h"

// ------ Global Variables and Objects ------
float __imuX, __imuY, __imuZ, __compI;

int z_tilt;
int item;
int z_angle;

// ------ Main Program ------
int main()
{
    imu_init(12, 13, 14, 15);

    while (1)
    {
        imu_readAccelCalculated(&__imuX, &__imuY, &__imuZ);
        z_tilt = (int)(100.0 * __imuX);
        item = (int)(100.0 * __imuY);
        z_angle = (int)(100.0 * __imuZ);
        print(("angle: "));
        print("%d\r", z_angle);
        imu_readAccelCalculated(&__imuX, &__imuY, &__imuZ);
        item = (int)(atan2(__imuS, __imuY) * 180.0 / PI);                 // <-- __imuS is UNDECLARED
        z_tilt = (int)(atan2(__imuZ, __imuY) * 180.0 / PI);
        print(("tilt: "));
        print("%d\r", z_tilt);
    }

}

dgately

Comments

  • Thanks for letting us know - I'll get a ticket in and start working on it soon.
    Thanks!
    Matt
  • Okay - it's a typo - it should be generating "__imuZ", so know that I know what to fix, I'll get it entered. The fix will appear in Demo early in the week, but it will be a few weeks before we push another update to the BETA/production servers.

    Thanks,
    Matt
  • Thanks, Matt!

    dgately
  • I found the bug, and submitted a fix, thanks for the catch!
Sign In or Register to comment.