[TriEmbed] ESP8266 Programming tip

Scott Hall scottghall1 at gmail.com
Tue Jan 26 15:51:46 CST 2021


I concur.

On 1/26/21 1:38 PM, Carl Nobile via TriEmbed wrote:
> This one may be better.
> https://deepbluembedded.com/why-use-timer-instead-of-delay/
>
>
> On Tue, Jan 26, 2021 at 1:35 PM Carl Nobile <carl.nobile at gmail.com
> <mailto:carl.nobile at gmail.com>> wrote:
>
>     John,
>
>     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.
>
>     I found this simple example of using an interrupt as a delay. It' uses an
>     Arduino, but the concept may help.
>     https://thekurks.net/blog/2016/4/25/using-interrupts
>
>     ~Carl
>
>     On Tue, Jan 26, 2021 at 1:22 PM John Vaughters via TriEmbed
>     <triembed at triembed.org <mailto:triembed at triembed.org>> wrote:
>
>         Carl,
>
>         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. `,~)
>
>         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.
>
>         Good discussion in any case and now I have a better grasp on Ticker.
>
>         Makes one of my Dad's best advice quotes ring true:
>
>         When all else fails, read the instructions ~ Dad
>
>         Good Stuff,
>
>         John Vaughters
>
>
>         On Tuesday, January 26, 2021, 12:51:13 PM EST, Carl Nobile
>         <carl.nobile at gmail.com <mailto:carl.nobile at gmail.com>> wrote:
>
>>         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.
>>         Almost all processors will be running interrupts even if you're not
>>         using any.
>>         There are other people in the group that have more experience with
>>         this than I, so just my two cents.
>>
>>         ~Carl
>

-- 
Scott G. Hall
Raleigh, NC, USA
ScottGHall1 at GMail.Com

/Although kindness is rarely a job, no matter what you do it's always an option./

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.triembed.org/pipermail/triembed_triembed.org/attachments/20210126/02fb497c/attachment.htm>


More information about the TriEmbed mailing list