Spark Logic

Microcontroller project: digital input and output

A single button and LED form a test circuit for learning GPIO direction, input pull-ups and active levels.

Wire and test one signal at a time

Use the board’s 3.3 V logic and a shared ground. Connect the button between a GPIO input and ground, enable its pull-up, and connect an external LED with a series resistor to a GPIO output. Confirm the selected pins from the board pinout.

With a pull-up the input reads high when released and low when pressed. First make the LED follow the input, then add debouncing if a press should increment a counter only once.

Input   Released = HIGH · Pressed = LOW
Output  LED on while the button is pressed

References