Push button → GPIO → LED
Build a simple push-button input and LED output experiment on an STM32 development board. The goal is to connect voltage levels, pull resistors, GPIO configuration and firmware behavior.
HARDWARE
MCU board, push button, LED/resistor and jumper wires.
FIRMWARE
Configure one GPIO as input and another as output.
OBSERVE
Press the button and verify the output transition.
DEBUG
Check pin mode, pull configuration and actual voltage.
- Configure an input pin
- Use an internal pull-up or pull-down where appropriate
- Configure an LED output
- Read the input and change the output
- Verify the signal with a meter or logic analyzer
// V1.3 lab skeleton
int main(void)
{
// Configure input GPIO
// Configure output GPIO
while (1)
{
// Read button → drive LED
}
}KEY TAKEAWAY
Always verify both firmware configuration and the physical electrical state.