logic is working inverted
Posted: Sat May 02, 2015 6:56 pm

Hello, recently I bought the raspberry2, and created my first progrma in python.
My doubt is that the relay actuation occurs in LOW or 0, ie, it seems that logic is working inverted, or am I crazy?
The relay module I'm using is similar, the mine has 4 relays.
I have also found that the order and function of the pins is equal in photo model and raspberry2. It turns out that when you run the program, when you run online LOW, the relay is triggered and turns the LED corresponds to the relay module.
follows the code:
Code: Select all
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
#board
#rl01=12
#rl02=16
#rl03=18
#rl04=22
#bcm
rl01=18
rl02=23
rl03=24
rl04=25
on=1
off=0
GPIO.setup(rl01, GPIO.OUT)
GPIO.setup(rl02, GPIO.OUT)
GPIO.setup(rl03, GPIO.OUT)
GPIO.setup(rl04, GPIO.OUT)
GPIO.output(rl04,GPIO.LOW)
time.sleep(5)
GPIO.output(rl04,GPIO.HIGH)
time.sleep(5)
GPIO.output(rl04,GPIO.LOW)
time.sleep(10)
GPIO.output(rl04,off)
time.sleep(5)
GPIO.output(rl04,on)
time.sleep(5)
GPIO.output(rl04,off)
time.sleep(10)
GPIO.cleanup()
