Using a button with Normally Closed contacts

I need to use a button with normally closed contacts in a project. At the moment it works with a pull-up 10k resistor and a button with normally open contacts. Is it easy to convert to a button with n/c contacts? Any help would be much appreciated.

Just change the code. The GPIO will be high when the button is pressed, low otherwise.

I was overthinking it, code changed, tested and working perfectly. Thank you for replying.

Now note that if the button and wiring is clean (no moisture or insulation problems) and a relatively short distance between button and Arduino, you can use INPUT_PULLUP - effectively a 47k resistor - instead of the 10k pullup.

Then you can switch off the pullup (set to INPUT instead) when not reading the button if you need to save a little current. If you did need a lower value pullup, you can control it from another pin to switch it off until required to read the button.

Thanks for the reply, my project is working fine with the external pull-up but I will have a play about with the INPUT_PULLUP function and look to use it in future.

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