I have a python program what control relay board via GPIO. When I set a GPIO port LOW the relay closes and HIGH opens the relay As example. I use this line to close the relay and open it again after 10 seconds
GPIO = webiopi.GPIO GPIO.digitalWrite(18, GPIO.LOW) time.sleep(10) GPIO.digitalWrite(18, GPIO.HIGH)
Now I've bought a new relay board, which works to opposite. On a GPIO.LOW it opens and a GPIO.HIGH the relais close
I thought to use this code, which is not working
GPH=GPIO.LOW GPL=GPIO.HIGH GPIO.digitalWrite(18, GPH) time.sleep(10) GPIO.digitalWrite(18, GPL)
GPH=GPIO.LOW NameError: name 'GPIO' is not defined
My question is: what is the proper way to put GPIO.HIGH and GPIO.LOW in a variable? so I can easy switch those.