Have one 8 Channel relay DS2408
http://www.hobby-boards.com/store/products.php?product=8-Channel-I%7B47%7DO-%288-Relay-Version%29
How do I turn on and off relays in Indigo?
and how I see what input is active?
//Jens
jens wrote:Have one 8 Channel relay DS2408
http://www.hobby-boards.com/store/products.php?product=8-Channel-I%7B47%7DO-%288-Relay-Version%29
How do I turn on and off relays in Indigo?
and how I see what input is active?
//Jens
<owd_DS2408 Description="8-Channel Addressable Switch">
<Name>DS2408</Name>
<Family>29</Family>
<ROMId>SNIP</ROMId>
<Health>7</Health>
<Channel>2</Channel>
<RawData>
FFFF00000088000000000000EB9A02000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100010001000100
</RawData>
<PrimaryValue>255</PrimaryValue>
<PIOLogicState>255</PIOLogicState>
<PIOOutputLatchState Writable="True">255</PIOOutputLatchState>
<PIOActivityLatchState Writable="True">0</PIOActivityLatchState>
<RSTZconfiguration Writable="True">0</RSTZconfiguration>
<PowerOnResetLatch Writable="True">1</PowerOnResetLatch>
<VccPowerStatus>1</VccPowerStatus>
</owd_DS2408>
jens wrote:Okey, Dave Thanks for trying..
list_of_relays = [
('P7',128),
('P6',64),
('P5',32),
('P4',16),
('P3',8),
('P2',4),
('P1',2),
('P0',1)
]
active_relays = []
for relay in list_of_relays:
if (status_count - relay[1]) >= 0:
active_relays.append(relay[0])
status_count = status_count - relay[1]
print active_relays
Helpful EDS Cats wrote:The OW-SERVER can set the output state of the DS2408 to any value between 0 to 255 (decimal) which corresponds with 0000 0000 to 1111 1111 (binary). Each bit represents the output state of one of the eight channels (0 through 7). Each channel with a bit equal to 0 is conducting. Each channel with a bit equal to 1 is nonconducting. Here are a few examples:
0 (Decimal) = 0000 0000 (Binary) sets all outputs to ON
128 (Decimal) = 1000 0000 (Binary) sets channel 7 to OFF, sets channels 0 through 6 to ON
170 (Decimal = 1010 1010 (Binary) sets channels 7,5,3 & 1 to OFF, sets channels 6,4,2 & 0 to ON
x = [---VALUE---]
counter = 7
switch_dict = {}
x_binary = int(bin(x)[2:])
x_binary_str = str(x_binary)
x_binary_str = x_binary_str.zfill(8)
print u"%s = %s\n" % (x, x_binary_str)
for switch in x_binary_str:
switch_name = u"S%s" % counter
switch_dict[switch_name] = switch
counter -= 1
for thing, value in reversed(sorted(switch_dict.iteritems())):
print thing, value
170 = 10101010
S7 1
S6 0
S5 1
S4 0
S3 1
S2 0
S1 1
S0 0
Users browsing this forum: No registered users and 0 guests