Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 8 months ago.
Ticker repeat
I'm currently building a device with a modem attached to a nRF51822 based dev platform (Seeed Arch BLE, because my nRF51 DK seems to be out of order), and I want that my nRF51 acts like a classic beacon, and, every 11 minutes, it wakes up sensors, get Values, and transmit it to my modem.
I already do the major part, with everything all right as, when I start the dev board, it gets sensors values, transmit it to the modem, acting like a BLE beacon all the time.
Now I try to implement the "11 minutes" constraint, and, I tried to do this with a periodic callback this way :
Part of my code
void sendCloudCallback (void) { updateSensorsValue(); sendModem(); } int main(void) { led1 = 1; Ticker ticker; ticker.attach(sendCallback, 660); //Some advertising and BLE init code while (true) { ble.waitForEvent(); } }
I believe that this value is far too high for a ticker attached callback, but I have no idea how to do this another way, keeping a low power consumption between BLE events and sensors wake + modem transmission. I want that it indefinitely runs the periodic callback (every 11min), but, when I test, it runs a first time, then a second time (11min later), and then nothing. So my ticker delayed callback runs just at startup and after 1 delay, then, nothing.
2 Answers
8 years, 8 months ago.
Make sure you have a recent version of the mbed lib (right click, update). Older versions have alot of ticker bugs.