Control it with a BUTTON
// WHAT YOU WILL LEARN
INPUT_PULLUP keeps the pin HIGH until the button pulls it to GND (LOW); one if/else switches the LED.
// LESSON NOTES
Part 6: control your LED with a BUTTON 🔘
Press → ON. Let go → OFF.
The trick: INPUT_PULLUP — a resistor built into the chip keeps pin 2 at 5 V (HIGH). Press the button and pin 2 connects to GND → LOW.
Then one if/else does the rest. 👀
Related lessons
// NEWSLETTER · FREE
Get new lessons + early access to the full course
One email when new lessons drop. No spam, unsubscribe any time.
✓ You're on the list. Check your inbox to confirm.
By joining you agree to the privacy policy.




