When using the RPi.GPIO library in Python you have to call
import RPi.GPIO as GPIO
and then
GPIO.setmode(GPIO.BOARD)
or
GPIO.setmode(GPIO.BCM)
What is the difference between these two options?
When using the RPi.GPIO library in Python you have to call
import RPi.GPIO as GPIO
and then
GPIO.setmode(GPIO.BOARD)
or
GPIO.setmode(GPIO.BCM)
What is the difference between these two options?
I got the information below from here.
The GPIO.BOARD option specifies that you are referring to the pins by the number of the pin on the plug - i.e the numbers printed on the board (e.g. P1) and in the middle of the diagrams below.
The GPIO.BCM option means that you are referring to the pins by the "Broadcom SOC channel" number, these are the numbers after "GPIO" in the green rectangles around the outside of the below diagrams:
Unfortunately the BCM numbers changed between versions of the Pi1 Model B, and you'll need to work out which one you have guide here. So it may be safer to use the BOARD numbers if you are going to use more than one Raspberry Pi in a project.
Pi1 Model B+, Pi 2B, Pi Zero, Pi 3B, and Pi 4B:
Pi 1 Model B Revision 2.0:
Pi 1 Model B Revision 1.0: