schufti wrote:const int led = 7; //pin on GPIO13 connected to LED
are you decided yet if the LED is on gpio 7 or 13 ?
If you intend to use nodemcu pin marked "D7" you should write
const int led = D7
const int led = 13
maybe that will make your code work ....
Still not word, const int led = 7 is not the problem,
The problem is I need esp8266 as accespoint, so if there is client connect, then led is on.