Most microcontrollers let you configure a timer that runs while the processor is in sleep, then triggers an interrupt to wake you up.<p>In this style of coding you end up with<p><pre><code>  main()
  {
  configure_interrupts();
  while(1)
  {
     do_irq_bottom_halves();
     sleep(); &#x2F;&#x2F; &quot;wfi&quot; in ARM
  }
  }</code></pre>