Introduction: Make a Pushbutton Without a Resistor
Need a pushbutton but don't have any resistors?
Using Arduino, 2 wires, one pushbutton, and one led, and Arduino, turn on and off an LED (or anything else you decide to turn on and off).
Instead of using the typical button schematic using a pullup or pushdown resistor, like the Fritzing image, here's a way to get around that, using Arduino, and declaring the button pin as a digital input, but then writing HIGH to that digital input pin.
In the setup function:
pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, HIGH);
LED from pin 13 to ground
Wire it like the schematic in the photograph:
Arduino pin 2 to the button pin.
the other side of the button is wired directly to ground.
Upload the following code:
Using Arduino, 2 wires, one pushbutton, and one led, and Arduino, turn on and off an LED (or anything else you decide to turn on and off).
Instead of using the typical button schematic using a pullup or pushdown resistor, like the Fritzing image, here's a way to get around that, using Arduino, and declaring the button pin as a digital input, but then writing HIGH to that digital input pin.
In the setup function:
pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, HIGH);
LED from pin 13 to ground
Wire it like the schematic in the photograph:
Arduino pin 2 to the button pin.
the other side of the button is wired directly to ground.
Upload the following code:

Participated in the
Electronics Tips and Tricks

Participated in the
LED Contest with Elemental LED
5 Comments
Question 11 months ago on Introduction
Thank you for the code that you wrote, it was very helpful to get us started on a school project. We are looking for a way to change the code to allow multiple independent push buttons and lights without resistors, would you be able to help us?
2 years ago on Introduction
Thank you very much.This was helped me for my non-arduino simple project. :-)
11 years ago on Introduction
A simpler way of enabling the internal pull-up resistor is to replace this: pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, HIGH);
with this:
pinMode(buttonPin, INPUT_PULLUP);
11 years ago on Introduction
your code comment "initialize the buttonPin as output" is wrong, you are actually enabling the internal pull-up resistor for that pin.
11 years ago on Introduction
your code comment "initialize the buttonPin as output" is wrong, you are actually enabling the internal pull-up resistor for that pin.