This is Arduino demo firmware for custom hardware consisting of NRF52840, NRF9160 and LIS2DE12 sensor. When movement is detected or the idle timer expires, it tries to get a GPS fix, and to send the coordinates via UDP to a test server, that echo's them back. For testing it is possible to fake a GPS fix.
Blue led: On: trying to get GPS fix
The program uses MBED (RTOS) functions. MBED is part of Arduino nRF52 framework. It creates several threads that run in paralel. Inter thread communication is done via a semaphore. This semaphore is used to indicate that either movement is detected or the idle timer had expired. With this implementation with a semaphore the CPU can be 97% of the time in sleep state (not valid in debugging mode). This is NOT possible when constantly polling a boolean in the main loop to see whether movement has occurred.
The software uses among others the Sodaq LIS3DE library. This library is compatible with the LIS2DE accelerometer that is used on this board.
The program is guarded with a hardware watchdog.
The main file contains several options to customize the behaviour. From timers to faking a GPS fix. For debugging use is made of the library SerialDebug. See source code for instuctions how to use it.