# Sample code for SWAN board wake on motion with LSM6DSOX

**URL:** <https://discuss.blues.com/t/sample-code-for-swan-board-wake-on-motion-with-lsm6dsox/1723>\
**Category:** Uncategorized\
**Created:** [October 11, 2023, 12:50pm UTC](https://discuss.blues.com/t/sample-code-for-swan-board-wake-on-motion-with-lsm6dsox/1723 "2023-10-11T12:50:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iarakis](https://avatars.discourse-cdn.com/v4/letter/i/7c8e57/32.png) [@iarakis](https://discuss.blues.com/u/iarakis)\
**Post date:** [October 11, 2023, 12:50pm UTC](https://discuss.blues.com/t/sample-code-for-swan-board-wake-on-motion-with-lsm6dsox/1723/1 "2023-10-11T12:50:28Z")

</div>

Hi, I would like to know if there is any usable sample for SWAN board wake on motion with LSM6DSOX accelerometer.

Regards

---

<div class="post-metadata">

**Author:** ![tjvantoll](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/tjvantoll/32/231_2.png) [@tjvantoll](https://discuss.blues.com/u/tjvantoll)\
**Post date:** [October 16, 2023, 4:39pm UTC](https://discuss.blues.com/t/sample-code-for-swan-board-wake-on-motion-with-lsm6dsox/1723/2 "2023-10-16T16:39:53Z")

</div>

Hey @iarakis,

I don’t have specific code for the LSM6DSOX accelerometer, but the Notecard itself has an onboard accelerometer that you can use to put a host like the Swan to sleep.

Here’s the request you need if you want to try it out. You’ll also need to write the Notecard’s `ATTN` pin to the Swan’s `EN` pin.

```json
{
  "req": "card.attn",
  "mode": "arm,motion"
}

```

Docs: [card Requests - API Reference - Blues Developers](https://dev.blues.io/api-reference/notecard-api/card-requests/)  
A project that uses this approach: [Remote Alerting Mailbox - Hackster.io](https://www.hackster.io/zachary_fields/remote-alerting-mailbox-8d3f08)

TJ

---

<div class="post-metadata">

**Author:** ![iarakis](https://avatars.discourse-cdn.com/v4/letter/i/7c8e57/32.png) [@iarakis](https://discuss.blues.com/u/iarakis)\
**Post date:** [October 17, 2023, 6:22am UTC](https://discuss.blues.com/t/sample-code-for-swan-board-wake-on-motion-with-lsm6dsox/1723/3 "2023-10-17T06:22:07Z")

</div>

Yes, I know there is an accelerometer in Notecard. However, my application is structural monitoring and I think I need a higher sensitivity for wakeup detection.

Regards,
