-->
Page 2 of 2

Re: Dust Sensor PPD42 problems

PostPosted: Tue Apr 06, 2021 6:31 am
by btidey
Don't use such long delays with ESP8266.

If you only want to trigger things every 30 seconds then use say a 1 second delay and a counter
Code: Select allint delayCounter = 0;
void loop() {
  if(delayCounter >= 30) {
    run_PPD42();
    run_CSS811();
    senddata();
    delayCounter = 0;
  }
  delay(1000);
  delayCounter++;
}

Re: Dust Sensor PPD42 problems

PostPosted: Tue Apr 06, 2021 9:16 am
by eriksl
Don't even do that, a delay of 1 second is still way too long and it doesn't help if you don't let the SDK code run in the meantime.

The proper way to do this is to add a timer (software, alarm) for the amount of time to wait and in the meantime return (to the SDK code). This is already for quite short delays, avoid any delay > 100 ms, but shorter is better anyway.