# Creating a command line version of LMIC

**URL:** <https://www.thethingsnetwork.org/forum/t/creating-a-command-line-version-of-lmic/23076>\
**Category:** Dragino\
**Created:** [February 22, 2019, 3:53am UTC](https://www.thethingsnetwork.org/forum/t/creating-a-command-line-version-of-lmic/23076 "2019-02-22T03:53:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [February 22, 2019, 9:35am UTC](https://www.thethingsnetwork.org/forum/t/creating-a-command-line-version-of-lmic/23076/2 "2019-02-22T09:35:40Z")

</div>

> [@pendleto](#):
>
> ttn-send -a appeui -d deveui -n devkey -s artkey -e devaddr -x hexdata

Nice, but beware:

- In general you’ll want OTAA, not ABP, so you need to store the result of the OTAA Join Accept.

- For Class A devices (the only thing supported by TTN’s community network right now), LMIC needs to await possible downlinks. For an OTAA Join Accept, that is sent after either 5 or 6 seconds; for a regular uplink after 1 or 2 seconds.

- LMIC keeps track of many more things: most importantly the duty cycle and frame counters, but also things like ADR for which it needs to keep specific counters, and then in some uplinks might need to set a specific bit to trigger ADR or include a MAC command to confirm the settings that the server gave it earlier. So, you’ll need to store the full LMIC state between invocations of the command line version, and make sure it [uses the correct time](https://www.thethingsnetwork.org/forum/t/lmic-plus-rfm95w-staying-awake-for-long-periods/7506/9) to do its duty cycle calculations. See [What LMIC state must be preserved during sleep mode?](https://www.thethingsnetwork.org/forum/t/what-lmic-state-must-be-preserved-during-sleep-mode/19477)

---

_[View the full topic](https://www.thethingsnetwork.org/forum/t/creating-a-command-line-version-of-lmic/23076)._
