My guess would be that either your switch widget inst connected to pin V10 in the app, or its a problem with the way you’ve connected your LED.
This means that you’ve connected your LED to pin GPIO0, which is the pin labelled D3 on your NodeMCU.
This isn’t a great pin to use, because if GPIO0 is pulled HIGH at startup then it will put your NodeMCU into programming mode rather than executing your sketch. See this for more info…
It may be simpler to work with the built-in Blue LED that is located near the D0 pin. This is connected to GPIO2, so change your code like this:
#define red 2
The built-in LED has inverted logic, so HIGH will turn it off, and LOW will turn it on.
Swapping the HIGHs and LOWs in your digitalWrite commands will fix this.
Pete.