I have a problem with my Raspbeery Pi, which is connected to a relay box via GPIO pin 7. I have tested with Gpio.board
and with gpio.bcm
without success in this code:
> #This program connects with gpio7
> #setup pins
> #GPIO.setmode(GPIO.BOARD) GPIO.setmode(GPIO.BCM) GPIO.setup(4, GPIO.OUT)
> #GPIO.setup(7, GPIO.OUT)#mode Board while True:
> GPIO.output(4, GPIO.HIGH)
> #GPIO.output(7, GPIO.HIGH)#mode Board
> time.sleep(5)
> GPIO.output(4, GPIO.LOW)
> #GPIO.output(7, GPIO.LOW) #mode Board
> GPIO.cleanup() #devuelve los pines a su estado inicial
>
> exit()
This is the error both in one way and the other:
Traceback (most recent call last):File"/home/pi/Desktop/RelayPrograms/5_7OnSleepOff.py", line 13, in GPIO.output(4, GPIO.HIGH)RuntimeError: Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)
Am I missing something?