-->
Page 1 of 1

wemos d1 mini UDP and analogread (edited)

PostPosted: Sat Mar 03, 2018 5:35 am
by Vsevolod
Hi,guys.
I succesfully play several month with esp8266 and now face a strange problem:
i have find that UDP message stop working right after i begin use analogRead(A0).
(digitalread(14) works fine)

in two different board wemos i was trying two type of mic (FC-04 and FC-109)
one with resistor for setting threshold level, and second without.
so in first board i digitalread(14) to check if sound level raise over some value (i need to adjust resistor with screwdriver to set level),
in second board i analogread(A0) for the same purpose, i want to set level by adjust some value and compare it with analogread(A0) result.
in both case i send UDP packet to comp in the same wifi.

after long hours of seeking a problem i find, that sending UDP from second board stop working immideately after first call analogread function , no matter wich level is on the A0 pin, so with zero sound level also stop working at once.
(if i try to only digitalread on second board, it shoot UDP packet fine)

who knows, whats the problem? :shock:
(of course the VCC pin of mic is connected to 3.3V)

refinement:
problem because of continuous analogread in the loop;
if you make delaymicrosecond(1200) after analogread, then UDP works normal.
if delay less then 1200, then UDP crash.
so analogread need 106mksec , then delay 1200 mksec then UDP works -
compare to digitalread 5mksec then UDP works fine.

Anyway, who knows - why analogread make such a difficulties to wifi???