Page 1 of 1

Sleep mode

Posted: Sat Aug 29, 2020 10:52 am
by mebab
I read a sensor every 10 ms by using an interrupt and do other stuff afterward with Arduino. I use the following while loop and fill-up an array while waiting inside the loop and exit the loop as soon as the array gets full.
I would like to keep a Nucleo L476 to do the same task with the minimum consumption power.

Code: Select all

    do
    {
      delay(1);
    }  while (arrayisfull == 0); // Wait loop
 
This loop takes a few seconds to be terminated. Is the sleep mode efficient in such cases? How to apply that here?

Many thanks for your guidance!

Re: Sleep mode

Posted: Sat Aug 29, 2020 3:11 pm
by stevestrong

Re: Sleep mode

Posted: Mon Aug 31, 2020 7:42 pm
by mebab
Thank you so much!
I implemented sleep mode and work further around this loop-case to find a better solution with less sleep-wake up procedure. With 1 ms sleep time, it has to sleep and wake up ten times during each 10ms interrupt time. I increased sleep time to 10 ms instead of 1 ms to get better performance.
Since the loop time varies and runs up to 10 seconds, is there any other way to get the lowest possible power consumption during this loop time?