Skip to content

Button Input

Buttons are the simplest way to provide user input to your projects. A momentary button closes the circuit only while pressed, allowing your code to respond to taps, presses, or long holds.


What It Does

This example reads the state of a button and shows how your program can respond when the button is pressed. It introduces the concept of digital input and forms the basis for interactive projects.


Real-World Applications

Buttons are everywhere in electronics, from toys to industrial systems. With button inputs, students can create:

  • ๐ŸŽฎ Game Controls โ€“ Simple joysticks, trigger buttons, or start/stop inputs.
  • ๐Ÿ”” Doorbells & Buzzers โ€“ Triggering a sound or notification.
  • ๐Ÿ  Smart Home Controls โ€“ Light switches, fan toggles, or appliance triggers.
  • ๐Ÿค– Robotics โ€“ Manual override or reset buttons.
  • ๐Ÿงช Learning Experiments โ€“ Teach the basics of logic, inputs, and event-driven programming.

Using a button, students begin to understand how human interaction drives digital systems.

โœ… Once you can read a button press, you can extend it to control LEDs, buzzers, motors, or even start whole projects with a single press.


Code