2

Consider my loop() in Arduino be:

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

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?

mohammad
  • 23
  • 5

0 Answers0