Skip to content

Running failed setup() before setmode() results in subsequent setup() call failing due to pin "being in use" #56

@theyoyojo

Description

@theyoyojo
>>> GPIO.setup(40, GPIO.OUTPUT)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'RPi.GPIO' has no attribute 'OUTPUT'
>>> GPIO.setup(40, GPIO.OUT)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rpi/RPi.GPIO2/RPi/core.py", line 1098, in setup
    channel[i] = channel_fix_and_validate(channel[i])
  File "/home/rpi/RPi.GPIO2/RPi/core.py", line 351, in channel_fix_and_validate
    raise RuntimeError("Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)")
RuntimeError: Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)
>>> GPIO.setmode(GPIO.BOARD)
>>> GPIO.setup(40, GPIO.OUT)
/home/rpi/RPi.GPIO2/RPi/core.py:1109: UserWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
                     Further attemps to use channel 21 will fail unless setup() is run again sucessfully
  warn("This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.\n \
>>> GPIO.setup(40, GPIO.OUT)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions