from numato_eth.eth import Eth_Module


#Please change the number of Relays and COM Port accordingly.

Relay = Eth_Module(numberRelays=32,deviceIP="192.168.10.53", username="admin", password="admin")

print(Relay.dev_info())

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

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

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

print(Relay.usr_get())
Relay.usr_set("admin")
print(Relay.usr_get())

print(Relay.pass_get())
Relay.pass_set("admin")
print(Relay.pass_get())

#To turn on a single relay & read the status
for i in range(0,32):
    if(i>=10):
        i=chr(i+55)
    Relay.relay_on(i) 
    
for i in range(0,32):
    if(i>=10):
        i=chr(i+55)
    print(Relay.relay_read(i))


for i in range(0,32):
    if(i>=10):
        i=chr(i+55)
    Relay.relay_off(i)


for i in range(0,32):
    if(i>=10):
        i=chr(i+55)
    print(Relay.relay_read(i))

    
#To turn on all the relays
Relay.relay_writeall("ffffffff")
print(Relay.relay_readall())

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

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

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

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

for i in range(0,8):
    print(Relay.adc_read(i))

Relay.reset()

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

Relay.reboot()
