How to connect SPDT sliding switch with NodeMCU?

Hello there iam working on a project, in that project I wanted to add SPDT sliding switch to get 0 and 1 for if and else condition if any one know how to code SPDT switch with NodeMCU please ping me back...

Wire the switch between input pin (configured to use the built-in pullup, of course) and GND.

The switch will read LOW when closed and HIGH when open.

could you please post the proper code?

pinMode (switchPin, INPUT_PULLUP);

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.