V3 arduino example for trigger sensor

Hi all… I’m having difficulty writing code that could trigger sending lora packet to lorawan ttn gateway.

Does anyone have simple example of how it could be done? All examples are based on loop time. I need it to send only once. Tn.x