# HG changeset patch # User Heiko Schlittermann # Date 1231278729 -3600 # Node ID 94281ba012c80644e0b0ddd52ce7820e7f3e8d06 # Parent 6acf8ea44e0a386a090f4f9a0c806c0426007e52 Fix: setting to "0" works now. And some more improved example. diff -r 6acf8ea44e0a -r 94281ba012c8 examples/client --- a/examples/client Tue Jan 06 22:33:39 2009 +0100 +++ b/examples/client Tue Jan 06 22:52:09 2009 +0100 @@ -6,14 +6,21 @@ use strict; use warnings; use Quancom; +use Time::HiRes qw(usleep); use Data::Dumper; MAIN: { my $q = new Quancom $ARGV[0]; my $r; - $q->set(1, 8 => 1)->ok or die $q->last_result->error_message; - $q->set(2, 64 => 1)->ok or die $q->last_result->error_message; + foreach (1..64) { + $q->set($_ => 1); + usleep 1e6/20; + } + foreach (1..64) { + $q->set($_ => 0); + usleep 1e6/20; + } # reset $q->full_reset->ok or warn "err: " . $q->last_result->error_message . "\n"; diff -r 6acf8ea44e0a -r 94281ba012c8 lib/Quancom.pm --- a/lib/Quancom.pm Tue Jan 06 22:33:39 2009 +0100 +++ b/lib/Quancom.pm Tue Jan 06 22:52:09 2009 +0100 @@ -94,8 +94,11 @@ my $bit = $_ % 8; $groups[$group] |= (1 << $bit); } - $_ = "SX 0100 " . join "", map { sprintf "%02x ", $_ } reverse @groups; - $self->cmd($_); + + my $cmd = $value ? "S" : "C"; + $cmd .= "X 0100"; + $cmd .= join "", map { sprintf "%02x ", $_ } reverse @groups; + $self->cmd($cmd); } sub set_timeout { @@ -187,6 +190,10 @@ this disables the socket communication and just simulates the Quancom module. +=item B( $bit, ... => $value ) + +This sets one or more bits the specified values (true, false). + =item B( I ) Send a Quancom string to the device. The string here should be