0

I wrote some python to blink a led. Without the GPIO.cleanup method, I had the following warning: "This channel is already in use, continuing anyway". Then I did

tempo=1

import RPi.GPIO as GPIO
import time

try:

  GPIO.setmode(GPIO.BOARD)
  GPIO.setup(12,GPIO.OUT)


  def acende(led):
      GPIO.output(led,1)
      return

  def apaga(led):
      GPIO.output(led,0)
      return

  while(1):
      acende(12)
      time.sleep(tempo)
      apaga(12)
      time.sleep(tempo)

except KeyboardInterrupt:
  print ("teclado")

except:
  print ("erro")

finally:
  GPIO.cleanup()

But I still got the same warning. How to completely erase my former GPIO settings ?

  • We need to see your code. Otherwise all we can do is speculate. – joan Apr 18 '16 at 8:43
  • You might expect the warning the first time you run the program. Do you still get the warning the SECOND time you run the program? – KDM Aug 19 '16 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.