user27363: I am setting up a page on NodeMCU running as a web server and I want to be able to turn on and off a light based on the url being clicked.
I want to know how I can get the status so that I can set the URL based on the pin status as well as pass  the GPIO pin status in the JSON from the NodeMCU web server.
The code is here.

user31693: Independent of the setting of port direction (input or output), pin can be read through the digitalRead():
int pin_light = 3;
int status = digitalRead(pin_light);


27363: <p>I am setting up a page on NodeMCU running as a web server and I want to be able to turn on and off a light based on the url being clicked.</p>

<p>I want to know how I can get the status so that I can set the URL based on the pin status as well as pass  the GPIO pin status in the JSON from the NodeMCU web server.</p>

<p>The code is <a href="https://arduino.stackexchange.com/questions/36330/how-to-make-5volt-relay-to-work-with-node-mcu?noredirect=1#comment72314_36330">here</a>.</p>
 31693: <p>Independent of the setting of port direction (input or output), pin can be read through the digitalRead():</p>

<pre><code>int pin_light = 3;
int status = digitalRead(pin_light);
</code></pre>
