To keep things simple, can anyone shed some light on how this can be done using WISBLOCK-API and spare GPIO pin on the RAK4631 to initial a lora message e.g. wakeup the RAK4631 when say a button is pressed and then go back to sleep?
Then in init_app() setup the pin and attach the interrupt to it. In this example I use WB_IO4 and RISING flank of the signal to trigger the interrupt.
bool init_app(void)
{
........
// Attach an external interrupt to wake-up the application
pinMode(WB_IO4, INPUT);
attachInterrupt(WB_IO4, ext_int_handler, RISING);
return true;
}
Points to know:
if the interrupt is called before LoRaWAN network join is finished, it will not send a packet.
if the interrupt is from a sensor, you might need to clear the sensors interrupt registers. You can check my RAK1904_acc.cpp example how I do it with the LIS3DH acc sensor.
Thankyou for your quick response.
The example provided looks pretty straight forward and exactly what I was after. I will give it a try and see how I get on.