Data Sheet
Guide V1.0
Email: keen@elecrow.com Web: www.elecrow.com ---Designed by Elecrow Keen
29
leg of the button connects to the 5 volt supply.
When the pushbutton is open (unpressed) there is no connection between the two legs of
the pushbutton, so the pin is connected to ground (through the pull-down resistor) and we
read a LOW. When the button is closed (pressed), it makes a connection between its two
legs, connecting the pin to 5 volts, so that we read a HIGH.
You can also wire this circuit the opposite way, with a pullup resistor keeping the input
HIGH, and going LOW when the button is pressed. If so, the behavior of the sketch will be
reversed, with the LED normally on and turning off when you press the button.
If you disconnect the digital I/O pin from everything, the LED may blink erratically. This is
because the input is "floating" - that is, it will randomly return either HIGH or LOW. That's
why you need a pull-up or pull-down resistor in the circuit.
Compile and upload
Tips: Refer to the operation demo (Step4 to Step8).
Language reference
Tips:click on the following name to jump to the web page.
If you fail to open, use the Adobe reader to open this document.
const
INPUT
Application effect
When you press the button, the built-in LED will light up, release is extinguished.