<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: FXLS8974CF, FXLS8974_Arduino Lib and how to set thresholds and debounce values in Sensors</title>
    <link>https://community.nxp.com/t5/Sensors/FXLS8974CF-FXLS8974-Arduino-Lib-and-how-to-set-thresholds-and/m-p/2262661#M9000</link>
    <description>&lt;P&gt;Hello Glenn,&lt;/P&gt;
&lt;P&gt;To detect motion on the X-axis using SDCD, make sure you check the correct bits in the SDCD_INT_SRC1 register:&lt;BR /&gt;- OT_EA indicates an outside-of-threshold event is active&lt;BR /&gt;- X_OT_EF confirms the X-axis caused it&lt;/P&gt;
&lt;P&gt;Also enable and route the interrupt properly:&lt;BR /&gt;- set INT_EN[SDCD_OT_EN] = 1 and route it to INT1 via INT_PIN_SEL&lt;BR /&gt;- configure SENS_CONFIG4 for active-high, push-pull output (or match your HW)&lt;/P&gt;
&lt;P&gt;Finally, call fxls89xx.run() after configuration to leave Standby mode. Thresholds in the Arduino library are in mg and debounce counts are based on ODR periods. Reading SDCD_INT_SRC1 clears latched flags.&lt;/P&gt;
&lt;P&gt;Hope it helps.&lt;/P&gt;
&lt;P&gt;BRs, Tomas&lt;/P&gt;</description>
    <pubDate>Mon, 15 Dec 2025 09:45:18 GMT</pubDate>
    <dc:creator>TomasVaverka</dc:creator>
    <dc:date>2025-12-15T09:45:18Z</dc:date>
    <item>
      <title>FXLS8974CF, FXLS8974_Arduino Lib and how to set thresholds and debounce values</title>
      <link>https://community.nxp.com/t5/Sensors/FXLS8974CF-FXLS8974-Arduino-Lib-and-how-to-set-thresholds-and/m-p/2261807#M8999</link>
      <description>&lt;P&gt;Goal: Trigger LED_X (high) as soon as X motion is detected, stay high until X motion stops&amp;nbsp;&lt;/P&gt;&lt;P&gt;Having an issues setting the Threshold and debounce&lt;/P&gt;&lt;P&gt;Product FRDM-STBI-A8974 Shield connected to Arduino Uno (3.3v)&amp;nbsp;&lt;A href="https://www.nxp.com/docs/en/data-sheet/FXLS8974CF.pdf" target="_blank"&gt;FXLS8974CF, 3-Axis Low-g Accelerometer, data sheet&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Using FXLS89xx_Arduino Lib&amp;nbsp;&lt;A href="https://github.com/ryraki/FXLS89xx_Arduino/blob/main/README.md" target="_blank"&gt;FXLS89xx_Arduino/README.md at main · ryraki/FXLS89xx_Arduino · GitHub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;What I see on serial:&lt;/P&gt;&lt;P&gt;WHO_AM_I = 0x86&lt;/P&gt;&lt;P&gt;19&lt;/P&gt;&lt;P&gt;19&lt;/P&gt;&lt;P&gt;E0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;0x86 - Good&lt;/P&gt;&lt;P&gt;19, 19, E0 I believe is an error kicked out from the lib, I'm not sending that info to the Serial.&lt;/P&gt;&lt;P&gt;I'm not getting the correct info back on the src variable. I'm not sure what I am missing.&lt;/P&gt;&lt;P&gt;If I change to the Z axes, the LED stays high, if I switch to the Y axes the LED will blink every now and then, the _XYZ the LED flickers ON/OFF really fast but _X__ gives me nothing. I'm sure I'm not initializing something properly. Any kick in the right direction would be great.&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;#include "FXLS89xx_Arduino.h"
#include &amp;lt;Wire.h&amp;gt;

#define FXLS8974CF_ADDR 0x18
FXLS89xx fxls89xx;

int LED_X = 8;
int INT1_PIN = 2;

void setup() 
{
  pinMode(LED_X, OUTPUT);
  pinMode(INT1_PIN, INPUT);

  Serial.begin(115200);
  Wire.begin();

  uint8_t whoami = fxls89xx.init();
  Serial.print("WHO_AM_I = 0x");
  Serial.println(whoami, HEX);

  fxls89xx.wake_odr = FXLS89xx::_6_25HZ;
  fxls89xx.wake_pm  = FXLS89xx::_HPM;
  fxls89xx.sensor_range = FXLS89xx::_2G;
  
  
  // Absolute mode, X-axis, ±25 mg thresholds, debounce=5 samples
  fxls89xx.sdcd(FXLS89xx::_ABSOLUTE, FXLS89xx::_X__, 25.0f, 25.0f, 5);
}

void loop()
{
  // Poll INT1 pin
  if (digitalRead(INT1_PIN))
  {
    uint8_t src=fxls89xx.reg_r(FXLS89xx::_SDCD_INT_SRC1);
    //Serial.println(src);
    if (src &amp;amp; 0x01)
    {
      digitalWrite(LED_X, HIGH);
      Serial.println("Motion detected on X-axis!");
    }
  if (src &amp;amp; 0x08)
    {
      digitalWrite(LED_X, LOW);
      Serial.println("Motion ended on X-axis.");
    }
  }
   delay(50); 
}&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 03 Feb 2026 20:56:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/FXLS8974CF-FXLS8974-Arduino-Lib-and-how-to-set-thresholds-and/m-p/2261807#M8999</guid>
      <dc:creator>YellowJacket</dc:creator>
      <dc:date>2026-02-03T20:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: FXLS8974CF, FXLS8974_Arduino Lib and how to set thresholds and debounce values</title>
      <link>https://community.nxp.com/t5/Sensors/FXLS8974CF-FXLS8974-Arduino-Lib-and-how-to-set-thresholds-and/m-p/2262661#M9000</link>
      <description>&lt;P&gt;Hello Glenn,&lt;/P&gt;
&lt;P&gt;To detect motion on the X-axis using SDCD, make sure you check the correct bits in the SDCD_INT_SRC1 register:&lt;BR /&gt;- OT_EA indicates an outside-of-threshold event is active&lt;BR /&gt;- X_OT_EF confirms the X-axis caused it&lt;/P&gt;
&lt;P&gt;Also enable and route the interrupt properly:&lt;BR /&gt;- set INT_EN[SDCD_OT_EN] = 1 and route it to INT1 via INT_PIN_SEL&lt;BR /&gt;- configure SENS_CONFIG4 for active-high, push-pull output (or match your HW)&lt;/P&gt;
&lt;P&gt;Finally, call fxls89xx.run() after configuration to leave Standby mode. Thresholds in the Arduino library are in mg and debounce counts are based on ODR periods. Reading SDCD_INT_SRC1 clears latched flags.&lt;/P&gt;
&lt;P&gt;Hope it helps.&lt;/P&gt;
&lt;P&gt;BRs, Tomas&lt;/P&gt;</description>
      <pubDate>Mon, 15 Dec 2025 09:45:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Sensors/FXLS8974CF-FXLS8974-Arduino-Lib-and-how-to-set-thresholds-and/m-p/2262661#M9000</guid>
      <dc:creator>TomasVaverka</dc:creator>
      <dc:date>2025-12-15T09:45:18Z</dc:date>
    </item>
  </channel>
</rss>

