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,
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,
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.
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
Yes, using a timer sounds like the best approach. I'm assuming your are talking about sending the data wirelessly? With BLE or some proprietary protocol?
For such long delays, I would recommend that you use the application timer library for creating timers. This use the RTC peripheral, which is lower power than TIMER peripherals. There is a tutorial available, but note that this is written for an old SDK version.
For relaying data using BLE, this example could be usefull. You can also use proprietary protocols like ANT, or higher level protocols like Bluetooth Mesh. It is hard to say what is the best solution for your application, this is something you need to figure out yourself.
I forgot to mention, i am using ble mesh for my project. And am using nrf5 SDK v 2.0.1. According to my research, the server example in light switch demo does work as a relay. So, would i just flash the as it is example code to my nrf52832 kit and put them in between to relay my data?? And the application timer library tutorial wont work with this new SDK version? Can you provide me with updated tutorials or any documentation? Thank you
I see, yes in mesh the nodes will work as relays. The timer library should work with with Mesh SDK, but it is not included. Please have a look at the getting started guide for details on integration with nRF5x SDK 15.0.0. I did link you to the documentation for SDK 15.0.0 application timer library. Please make sure you follow the section "Migration note", otherwise the library should work as described in the tutorial.
okay, i should do a further research on this. Also, yesterday Bjorn, left me unattended. I was having trouble in building the example project using my SES environment. i am getting the following error.
I have mentioned the path to my board files.
Ca you help me with this? Thank you