DigitalPin toggle error

First of all, there are some errors in the comments regarding pin numbering…

If you are using one of the common NodeMCUs that has only one onboard LED then this is connected to GPIO2, which you are using a relay output.
If it’s a NodeMCU with two LEDs then the second on is attached to GPIO16, which is also in use as a relay output.

Which one is treated as LED_BUILTIN will depend on the option you chose when you compiled your code in the IDE…
image

You should also read this, about the suitability of the pins you are using…

As you’ll see, the NodeMCU doesn’t have enough suitable pins for your project, and you’d be better using an ESP32.

Pete.