I have the follow code in my application for a PCA10028 program from the nRF51 Development Kit (S110 v9.0):
int main(void)
{
int i = 0;
while(true)
{
SEGGER_RTT_printf(0, "%d\n", i);
i++;
nrf_delay_ms(1000);
}
}
Output:
0
0
0
0
I want the variable "i" to increment 1,2,3... but it looks like during the nrf_delay_ms() the device is resetting my variable to 0 every time.
Is there any way to have this variable persisted without the use of "pstorage.h"?