a short while ago you wrote the code below for me as i wanted short-period wait function that would allow other tasks to run.
Question - what should the divide by value be for an esp8266 ? I
Code: Select all
'100,000 microseconds in a second
Sub fnWait(byVal ulWaitMicroseconds as unsignedlong)
dim mt0 as Microtime_t
#if Option.TargetDevice="328l"
dim ulWaitCycles as unsignedlong = CUlng(CSng(ulWaitMicroSeconds) / 8.68)
#else
dim ulWaitCycles as unsignedlong = CUlng(CSng(ulWaitMicroSeconds) / 4.34)
#endif
dim ulDelta as unsignedlong
Call GetMicroTime(mt0)
ulDelta = GetElapsedMicroTime(mt0)
while ulDelta<ulWaitCycles
Yield
ulDelta = GetElapsedMicroTime(mt0)
wend
end sub