LoRaMac coding guidance on ESP32

It’s great having access to a device that can run the official Semtech code - well done!

I have two things I need to do:

Wake up every minute to check sensors are in range (ie no alarm)
Send a packet out of schedule if there is a sensor alarm.

I think I need to create a new timer because I think the device wakes up when a timer expires but that bit of code is in the assembly so I can’t be sure and my code tests have got confusing.

I totally failed yesterday to find a way to send on demand - I tried the device state and other things as well.

I did manage to programmatically change the data rate for one transmission, but then it appears to reset itself back to the setting in the defines.

Does anyone have sample code for a timer task for sensor readings and for triggering a send please.



PS, looking forward to getting my CubeCell Dev boards to try them out!

Hi @nmcc

If you just want to upload sensor data every minute, it’s quite simple, just need to change the APP_TX_DUTYCYCLE in the Commissioning.h file.

But if you need to create a new timer, works become harder, because you may need to fix the main link list.

Thanks for responding.

It’s triggering a send when a situation arises - ie on demand.

What is the main link list you are referring to?

And what is the IDE you are using?

You can use GPIO interrupt to trigger uplink.

I use Sloeber to develop Arduino software.

Yes, use an interrupt - but what command do I use to tell the Semtech LoRa MAC software to send immediately?