Use of GPIO16 or D0 pin on Node MCU? Answered
I have already solved this myself, but I will put it down here for others that might have the same problem on Node MCU. So I used pin 16 (D0) as the input pin and pin 13 (D7) as the LED pin, I changed the numbers in the code, to suit my wiring. When I uploded the code it didnt work, ofc... I tried changing both names to D7 and D0, that didnt change anything though. After I made sure that D7, pin 13, was working properly with another program, I tested D0 so pin 16. D0/pin 16 didnt work properly, the question is WHY?. When I changed D0 to D2 so pin 4, everything started working nicely. Because of my testing, I suspect that Pin 16, D0, has some other role that doesnt let it work properly. If you look at the pinout of Node MCU, you can see other funcions of pin 16, D0, you can see other functions of the pin written down. Try using a diferent pin, it should work fine then. Hope this helps anyone.