Arduino sketch integration with specific function

Hi there, community!

I am currently having my Air pollution project with SDS011 sensor and WeMos D1 (arduino based with esp 8266 integrated on board).

I am struggling to adapt it to Simply said, can you advise / help.

Here is the sketch I am using:

I appreciate in advance your suggestions on this topic.

With regards