Skip to main content
1 of 3
Simon Fitch
  • 47.4k
  • 3
  • 25
  • 135

A potential divider is perfectly fine:

schematic

simulate this circuit – Schematic created using CircuitLab

If there's any chance that the input might stray outside the bounds 0V to 12V, this will also restrict current flowing via the input protection diodes of the GPIO line.

Simon Fitch
  • 47.4k
  • 3
  • 25
  • 135