I am trying to make my atmega sleeping for a specific time using "LowPower.h".
As you might know, the maximum is 8 seconds, so, I decided to improve and do something like that :
Putting the sleeping time as an argument of the function.
I did not put everuthing, which is not necessary, but the problem is located at the argument of the function from my char table when I compile it.
int INTERVALLE=30;//Minimum 10 secondes
int mult;
int i,j;
char sleeping_char[10][12]={"SLEEP_8S","SLEEP_4S","SLEEP_2S","SLEEP_1S","SLEEP_500MS",
"SLEEP_250MS","SLEEP_120MS","SLEEP_60MS","SLEEP_30MS","SLEEP_15MS"};
int sleeping_time[10]={8000,4000,2000,1000,500,250,120,60,30,15};
double old_time;
old_time=0;
for (i=0;i<10 ; i++){
mult=(((double)INTERVALLE*1000-temps-old_time)/sleeping_time[i]);
for (j=1;j<=mult ; j++){
LowPower.powerDown(sleeping_char[i], ADC_OFF, BOD_OFF);
}
old_time=old_time+mult*sleeping_time[i];
}
delay(((double)INTERVALLE*1000-temps-old_time));