from numato_usb_relay.relay import Relay


Device = Relay(numberRelays=1, port="COM50", name="USBR")

#To get the version of the module
print(Device.ver())

#To get the Device Id 
print(Device.id_get())

Device.id_set("12341234")
print(Device.id_get())

#To turn on a single relay & read the status
for i in range(0,4):
    i= str(i).zfill(3)
    Device.relay_on(i) 
    
for i in range(0,4):
    i= str(i).zfill(3)
    print(Device.relay_read(i))

for i in range(0,4):
    i= str(i).zfill(3)
    Device.relay_off(i) 

for i in range(0,4):
    i= str(i).zfill(3)
    print(Device.relay_read(i)) 

   
## Gpios
    
for i in range(0,5):
    i=str(i).zfill(3)
    Device.gpio_set(i)

for i in range(0,5):
    i=str(i).zfill(3)
    print(Device.gpio_status(i))

for i in range(0,5):
    i=str(i).zfill(3)
    Device.gpio_clear(i)

for i in range(0,4):
    i=str(i).zfill(3)
    print(Device.gpio_status(i))

for i in range(0,8):
    i=str(i).zfill(3)
    print(Device.gpio_read(i))
   
for i in range(0,4):
    i=str(i).zfill(3)
    print(Device.adc_read(i))


#To get the Power Status of the module
print(Device.info())

#Setting the Gpio Power-On Direction & Value
Device.relay_poweron("00")

Device.gpio_poweron("0f")

print(Device.info())

