When I try to toggle the Raspi pin no 40 using the code it gives me message
RuntimeWarning : The channel is already in use, continuing anways and asks to disable warnings. Even after doing GPIO.setwarnings(False), the warning doesn't pop but the port does not toggle at all. I had tested the RPI.GPIO library quite a while ago their was no problem, in toggling the ports.
#! /usr/bin/python
import array
import os
import time
import RPi.GPIO as GPIO
def main():
GPIO.setmode(GPIO.BCM)
GPIO.setup(40,GPIO.OUT)
time.sleep(1)
while True:
GPIO.output(40,GPIO.HIGH)
time.sleep(5)
GPIO.output(40,GPIO.LOW)
time.sleep(5)
if __name__=='__main__':
try:
main()
except KeyboardInterrupt:
spi.close()
GPIO.cleanup()
finally:
GPIO.cleanup()