This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

application code flow(threads)

int main(void)
{
initialize();
execution_start(start);

for (;;)
{
(void)sd_app_evt_wait();
}
}

can you explain me the execution of code flow in the main with these APIs? 

Thanks,

Parents
  • Your code will do some initialization, then start execution of something, then enters a endless loop. sd_app_evt_wait will put the device into system on sleep mode. If you have initialized and started something that generates interrupts, your code will wake and handle events whenever they occur.

  • Yes, that is correct.

    I'm not sure I understand your question. What sensor data are you sending, and how/where are you sending it? If you want to send data at a fixed interval, you need to setup a timer that sample the sensor and send the data. The timer will generate interrupts. If you don't want to use interrupts, you need to constancly pull the sensor data, and stall the CPU to generate delays. This is bad practise, and is not something I would recommend. If you want something to happen on a button press, you either need interrupts or you need to constantly check the state of the button/GPIO.

  • I am using a simple DHT11 temp and humidity sensor data and want the node to send this data after every 30 seconds to a far placed node which could then send the data to my mobile application. So, the best way would be to setup a timer that generates an interrupt after every 30 seconds and then place a few relay nodes in between my sensor node and the final destination node. is that correct? If this sounds right to you, can you please refer me to some good links to follow, in order to generate timer based interrupts and also how to relay the data through the in between placed nodes? Thank you   

Reply
  • I am using a simple DHT11 temp and humidity sensor data and want the node to send this data after every 30 seconds to a far placed node which could then send the data to my mobile application. So, the best way would be to setup a timer that generates an interrupt after every 30 seconds and then place a few relay nodes in between my sensor node and the final destination node. is that correct? If this sounds right to you, can you please refer me to some good links to follow, in order to generate timer based interrupts and also how to relay the data through the in between placed nodes? Thank you   

Children
No Data
Related