Device::Quasar3108 - Control Quasar Electronics Serial I/O Module
use Device::Quasar3108; my $io = new Device::Quasar3108( '/dev/ttyS0' ); # Turn all relays off $io->relay_set( 0 ); # Turn relay 1 on $io->relay_on( 1 ); # Get status of input 2 my $status = $io->input_status( 2 );
Device::Quasar3108 is a perl module for controlling Quasar Electronics Serial Isolated I/O module (kit number 3108). The kit has eight relays and four opto-isolated inputs. http://www.quasarelectronics.com/3108.htm
It seems very similar (identical?) to Carl's Electronic Kits number CK1610: http://www.electronickits.com/kit/complete/elec/ck1610.htm
The perl module was tested on Debian Linux 3.1, but should work on most POSIX systems.
Relays are numbered 1 to 8 and inputs are numbers 1 to 4.
The new method opens and configures the serial port to talk to the Quasar 3108 serial module. It does not send any commands to the kit itself.
Use 'ping()' to ensure that you are communicating with the module correctly.
Turns on the specified relay. Returns 1 if successful or 0 on failure.
Turns off the specified relay. Returns 1 if successful or 0 on failure.
Toggle the specified relay. Returns 1 if successful or 0 on failure.
Turn the specified relay on then off again. The period the relay is turned on for is in seconds, the default is 0.25 seconds.
Returns 1 if successful or 0 on failure.
Set all the relays at once, using an 8-bit number. Returns 1 if successful or 0 on failure.
Gets the current status (0/1) of the specified relay. Use relay number 0 to return the status of all the relays as an 8-bit hexadecimal number.
Gets the current status (0/1) of the specified opto-coupled input. Use input number 0 to return the status of all the inputs as an 8-bit hexadecimal number (top nibble is always 0).
Returns the version number of the perl module.
Returns the firmware version string of the hardware.
This method just sends a return character to the module to check to see if it is still there. If the module returns the command prompt correctly ('#'), then this function returns 1, otherwise it returns 0.
Device::Serial
http://www.quasarelectronics.com/3108.htm
Please report any bugs or feature requests to bug-device-quasar3108@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you will automatically be notified of progress on your bug as I make changes.
bug-device-quasar3108@rt.cpan.org
Nicholas J Humfrey, njh@ecs.soton.ac.uk
Copyright (C) 2005 Nicholas J Humfrey
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.005 or, at your option, any later version of Perl 5 you may have available.
To install Device::Quasar3108, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::Quasar3108
CPAN shell
perl -MCPAN -e shell install Device::Quasar3108
For more information on module installation, please visit the detailed CPAN module installation guide.