You are calling that function thousands of times a second by having it directly in the
void loop() like that.
I don’t know what
automatic.listen() is, probably a part of some button reading library, but if conditions are right then you are potentially also running those
digitalWrite() commands hundreds or thousands of times a second.
While this works just fine in Arduino world, once you start entering IoT world there are lots of other tasks, like maintaining a communication link, that need to share the Arduino’s clock time.
Thus, as described in that document I linked to, you use timer based functions instead of filling the
void loop() with code or directly calling other functions from it (basically the same thing).