Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. class relay(pigpio.pi):
  2.  
  3. def __init__(self,ip_addr):
  4. pigpio.pi.__init__(self)
  5. self.GPIO=[4,5,6,12]
  6. self.rpi=pigpio.pi(ip_addr)
  7. for t in range(len(self.GPIO)):
  8. self.rpi.write(self.GPIO[t],0)
  9.  
  10. def switch_state(self,i,state):
  11. self.rpi.write(self.GPIO[i],state)
  12.  
  13. pi_1=relay('192.168.2.112') # creating first Rpi link
  14. pi_2=relay('192.168.2.113') # creating second Rpi link
  15.  
  16. x=0
  17. pi_1.switch_state(x,0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement