in reply to Saving Options
Store the output states (off/on as 0,1) in an array and convert to decimal when you make a change. Something like this perhaps
poj#!perl use strict; my @io = (1,0,0,0,0,0,0,0); # all off switch(3,1); # left light on switch(3,0); # left light off switch(4,1); # left bell on switch(4,0); # left bell off switch(3,1); # left light on switch(4,1); # left bell on switch(3,0); # left light off switch(4,0); # left bell off sub switch { $io[$_[0]] = $_[1]; my $num = oct('0b'.join '',@io); # bin to dec my $cmd = '<f 1108 '.$num.'>'; print $cmd."\n"; #$port->write($cmd); #$port->lookclear(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Saving Options
by FreeBeerReekingMonk (Deacon) on Dec 21, 2015 at 18:16 UTC |