Does using the delay function use any less power than spinning in a polling loop on a timer?
-
> Polling loop on a timer? What would you mean with that? Power consumption is quite a logic thing I believe, every peripheral that's on will draw power. And every clock tick will consume a bit of power. So to decrease power consumption one must deactivate peripherals or underclock/deactivate the clock. (Sleep modes)– aaaCommented Apr 7, 2015 at 8:04
-
Polling loop on a timer means having something like while(now>timer1){}; this is a very standard way of waiting for some period of time– benathonCommented Apr 7, 2015 at 8:16
2 Answers
That depends very much on how delay() was written (and how it will be written in the future!). There are "sleep modes", which will reduce the power consumption of the arduino - these are one of the best way to reduce power consumption. Delay() may or may not activate these. If not, there could be a replacement Delay() function that could do this.
If you want to reduce power, check out http://www.gammon.com.au/power - this is an excellent step-by-step tutorial on how to reduce power consumption from 50mA down to 288 µA
-
1
The answer is probably "they are equal" because what the CPU is doing is less than 1% of power draw. In order to save power while waiting you can put the chip to sleep. Assuming you have an Arduino uno, this post contains sample code about sleeping and current consumption. http://forum.arduino.cc/index.php?topic=78430.0
Maybe explain what you are doing (what size battery you have) and we can add some advice about ways to save power