setWatch equivalent for I2C?

Posted on
  • I'm trying to set up a setWatch equivalent for the ICM20948. Is there anyway I can use the function on a variable or a simple way I can set up an equivalent function to watch a variable?

  • This is on an MDBT42Q btw.

  • I'm not sure I understand the question... The ICM20948 is a 9 axis acceleration sensor?

    Usually if you want to get a callback when there's movement from an accelerometer you configure the sensor so that it changes the state of its INT pin when the moment happens - then you just connect that wire to Espruino and setWatch on that.

  • Unfortunately, the PCB that I'm using doesn't have the INT pin connected to the MDBT42Q. That's why I'm trying to configure a software setWatch equivalent by watching the register or a variable. I hope that makes sense?

  • I just set up a small function to read every 50ms and calculate the euclidian distance with the previous value and it works fine. Thanks!

  • Ok, great! But yes - just to confirm - that's about the only thing you could do (read continuously and check the values).

  • would you mind sharing reading the icm20948 process?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

setWatch equivalent for I2C?

Posted by Avatar for geek_god @geek_god