from numato_usb_relay.relay import Relay 

#Please change the number of Relays and COM Port accordingly.
#Numato(numberRelays=options.relays, port=options.port, baudrate=options.baudrate, timeout=options.timeout, name=options.name)
Device = Relay(numberRelays=64, port="COM78", name="usb")

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

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

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


#To turn on a single relay & read the status
for i in range(0,65):
    if(i<10):
        i=str(i).zfill(2)
    Device.relay_on(i) 

for i in range(0,65):
    if(i<10):
        i=str(i).zfill(2)
    print(Device.relay_read(i))

for i in range(0,65):
    if(i<10):
        i=str(i).zfill(2)
    Device.relay_off(i)

for i in range(0,65):
    if(i<10):
        i=str(i).zfill(2)
    print(Device.relay_read(i))

    
#To turn on all the relays
print(Device.relay_readall())
Device.relay_writeall("ffffffffffffffff")
print(Device.relay_readall())
Device.reset()


for i in range(0,10):
    Device.gpio_set(i)

for i in range(0,10):
    print(Device.gpio_read(i))

for i in range(0,10):
    Device.gpio_clear(i)

for i in range(0,10):
    print(Device.gpio_read(i))

for i in range(0,10):
    print(Device.adc_read(i))


