0
0
Raspberry Piprogramming~10 mins

GPIO pin numbering (BCM vs BOARD) in Raspberry Pi - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the GPIO mode to BCM numbering.

Raspberry Pi
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.[1])
Drag options to blanks, or click blank then click option'
ABOARD
BNUM
CPIN
DBCM
Attempts:
3 left
💡 Hint
Common Mistakes
Using BOARD instead of BCM for BCM numbering.
2fill in blank
medium

Complete the code to set up pin 18 as an output using BCM numbering.

Raspberry Pi
GPIO.setup([1], GPIO.OUT)
Drag options to blanks, or click blank then click option'
A18
B12
C7
D22
Attempts:
3 left
💡 Hint
Common Mistakes
Using physical pin numbers instead of BCM numbers.
3fill in blank
hard

Fix the error in the code to set the GPIO mode to BOARD numbering.

Raspberry Pi
GPIO.setmode(GPIO.[1])
Drag options to blanks, or click blank then click option'
APIN
BBOARD
CBCM
DNUM
Attempts:
3 left
💡 Hint
Common Mistakes
Using BCM instead of BOARD for physical pin numbering.
4fill in blank
hard

Fill both blanks to create a dictionary mapping physical pins to BCM pins for pins 7 and 11.

Raspberry Pi
pin_map = {7: [1], 11: [2]
Drag options to blanks, or click blank then click option'
A4
B17
C27
D22
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up physical and BCM pin numbers.
5fill in blank
hard

Fill all three blanks to set up physical pin 12 as output, set it high, and then clean up.

Raspberry Pi
GPIO.setmode(GPIO.[1])
GPIO.setup([2], GPIO.OUT)
GPIO.output([3], GPIO.HIGH)
GPIO.cleanup()
Drag options to blanks, or click blank then click option'
ABOARD
B12
DBCM
Attempts:
3 left
💡 Hint
Common Mistakes
Using BCM mode but physical pin numbers.