-2

I want to record data from dht11 and turn on the LED in the same code the dht11 work good by separate code the led also work well by separate code the problem is when I make it one py code problem become with error

ValueError: A different mode has already been set!

1
  • what is your question?
    – jsotola
    May 31, 2022 at 19:07

1 Answer 1

0

I guess you have two or more calls to GPIO.setmode().

You should only have one call to GPIO.setmode().

If one is using GPIO.BOARD and one is using GPIO.BCM you will have to choose one and amend the code to use that GPIO numbering scheme.

2
  • first, I use import RPi.GPIO as gpio and import RPi.GPIO as gpio when I add import adafruit_dht it gives ValueError: ValueError: A different mode has already been set! ... any suggestion ??
    – Asaad
    Jun 3, 2022 at 11:56
  • The Adafruit module is setting a different mode to that set in the other script.
    – joan
    Jun 3, 2022 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.