Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class relay(pigpio.pi):
- def __init__(self,ip_addr):
- pigpio.pi.__init__(self)
- self.GPIO=[4,5,6,12]
- self.rpi=pigpio.pi(ip_addr)
- for t in range(len(self.GPIO)):
- self.rpi.write(self.GPIO[t],0)
- def switch_state(self,i,state):
- self.rpi.write(self.GPIO[i],state)
- pi_1=relay('192.168.2.112') # creating first Rpi link
- pi_2=relay('192.168.2.113') # creating second Rpi link
- x=0
- pi_1.switch_state(x,0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement