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

How to make Nrf51822 wake up by button, increment variable then sleep

I've just started working with Nrf51822, I'm trying to make this scenario for weeks but i failed.

Plz help me!

How to make Nrf51822 wake up by a button click, increment a variable then go back to sleep? i've tested __WFI() and __WFE() but it doesnt work.

Parents
  • In my tests with the sleeping and system-off modes is that the devices automatically sleeps when it does nothing. This what the function power_manage() is for. I have seen hardly any difference in current consumption when sleeping or when in power_manage.

    It's more power efficient to go to system-off but then you'll need to save all your values in flash or use pstorage.

    If sleeping is enough for you then I would just add the button handler and increment when button is pushed.

    You can use this: devzone.nordicsemi.com/.../

    Or use App_button library there are many examples and questions about this topic that can help you.

Reply
  • In my tests with the sleeping and system-off modes is that the devices automatically sleeps when it does nothing. This what the function power_manage() is for. I have seen hardly any difference in current consumption when sleeping or when in power_manage.

    It's more power efficient to go to system-off but then you'll need to save all your values in flash or use pstorage.

    If sleeping is enough for you then I would just add the button handler and increment when button is pushed.

    You can use this: devzone.nordicsemi.com/.../

    Or use App_button library there are many examples and questions about this topic that can help you.

Children
No Data
Related