<div dir="ltr">My cat feeder is based on this concept.  All the time critical tasks (as defined by cats) are handled in Timer Callbacks (micropython's version).  They are much more accurate than the RTC since they are based on processor ticks.  As a bonus, the web server runs on the main thread and I can ^C out to Repl without harm.  The feeder keeps running. even while I'm debugging.<div><br></div><div>The cats appreciate this implementation.</div><div><br></div><div>Mike</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 26, 2021 at 1:35 PM Carl Nobile via TriEmbed <<a href="mailto:triembed@triembed.org">triembed@triembed.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">John,<div><br></div><div>So I assume you need a delay there, so what you can do is use an interrupt in your delay. Then the delay is managed between all other interrupts.</div><div><br></div><div>I found this simple example of using an interrupt as a delay. It' uses an Arduino, but the concept may help.</div><div><a href="https://thekurks.net/blog/2016/4/25/using-interrupts" target="_blank">https://thekurks.net/blog/2016/4/25/using-interrupts</a><br></div><div><br></div><div>~Carl</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 26, 2021 at 1:22 PM John Vaughters via TriEmbed <<a href="mailto:triembed@triembed.org" target="_blank">triembed@triembed.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Carl,<br>
<br>
Right, makes sense, I really use delays sparingly and go for millis() But this was a copy-paste task. and it was only 25ms of delay, so I let it slide. And considering I am probably only using like 10% of computing power I thought I could let it slide. And I could have if it wasn't for you meddling programmers. `,~) <br>
<br>
Normally I only use a short delay at the end of the loop if the loop is moving to fast, or for comm purposes. so definitely out of norm for me. I still like the original work around though. I would use it again if in a pinch.<br>
<br>
Good discussion in any case and now I have a better grasp on Ticker. <br>
<br>
Makes one of my Dad's best advice quotes ring true:<br>
<br>
When all else fails, read the instructions ~ Dad<br>
<br>
Good Stuff,<br>
<br>
John Vaughters<br>
<br>
<br>
<br>
<br>
<br>
<br>
On Tuesday, January 26, 2021, 12:51:13 PM EST, Carl Nobile <<a href="mailto:carl.nobile@gmail.com" target="_blank">carl.nobile@gmail.com</a>> wrote: <br>
<br>
<br>
<br>
<br>
<br>
Yeah, delays could mess with interrupts even if they are not in the interrupt itself. Actually what happens is the interrupt messes with the delay. If the interrupt happens in the middle of the delay the delay will be longer than what you set it at.<br>
Almost all processors will be running interrupts even if you're not using any.<br>
There are other people in the group that have more experience with this than I, so just my two cents.<br>
<br>
~Carl<br>
<br>
_______________________________________________<br>
Triangle, NC Embedded Computing mailing list<br>
<br>
To post message: <a href="mailto:TriEmbed@triembed.org" target="_blank">TriEmbed@triembed.org</a><br>
List info: <a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" rel="noreferrer" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
TriEmbed web site: <a href="http://TriEmbed.org" rel="noreferrer" target="_blank">http://TriEmbed.org</a><br>
To unsubscribe, click link and send a blank message: mailto:<a href="mailto:unsubscribe-TriEmbed@bitser.net" target="_blank">unsubscribe-TriEmbed@bitser.net</a>?subject=unsubscribe<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr">-------------------------------------------------------------------------------<br>Carl J. Nobile (Software Engineer)<br><a href="mailto:carl.nobile@gmail.com" target="_blank">carl.nobile@gmail.com</a><br>-------------------------------------------------------------------------------</div>
_______________________________________________<br>
Triangle, NC Embedded Computing mailing list<br>
<br>
To post message: <a href="mailto:TriEmbed@triembed.org" target="_blank">TriEmbed@triembed.org</a><br>
List info: <a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" rel="noreferrer" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
TriEmbed web site: <a href="http://TriEmbed.org" rel="noreferrer" target="_blank">http://TriEmbed.org</a><br>
To unsubscribe, click link and send a blank message: mailto:<a href="mailto:unsubscribe-TriEmbed@bitser.net" target="_blank">unsubscribe-TriEmbed@bitser.net</a>?subject=unsubscribe<br>
<br>
</blockquote></div>