GPIO basics
Outputs, inputs, and why you still need a resistor.
GPIO pins are 3.3 V on current Raspberry Pi boards. Do not feed them 5 V. An LED needs a series resistor. A button needs a defined pull-up or pull-down so the pin is not floating.
from gpiozero import LED
led = LED(17)
led.blink(on_time=0.5, off_time=0.5)gpiozero is the comfortable API on Raspberry Pi OS. The number you pass is a BCM pin number unless you configure it otherwise. Unplug power before you rewire.