Consider my loop() in Arduino be:

void loop(){
  for(int i = 0; i<100; i++){
   Value[i] = analogRead(A0);
   //delay(2) //when I use this line esp8266 works properly
   Udp.beginPacket(IP, Port);
   Udp.write(Value, 100);

after analogRead() UDP can't send packets and crash occur after a moment. But when I use delay(2) line in the above code it works properly. I want to record samples of microphone with 16000 sample rate and I use 62 microseconds for this. Thus in my application it is not possible for delay 2 milliseconds. How can I fix this without delay?

  • 1
    hard use of A0 disturbs WiFi signal measuring done by SDK with the same ADC. use external ADC for continues measurement with esp8266
    – Juraj
    Commented Apr 28, 2019 at 16:22
  • Thank you for replying.
    – mohammad
    Commented Apr 28, 2019 at 16:55
  • +1 for the excellent answer Juraj. I did not know that hard use of the ADC would cause issues with the WiFi signal :)
    – VE7JRO
    Commented Aug 29, 2021 at 0:02


Browse other questions tagged or ask your own question.