- SEE ALSO
Device::Conrad::RelaisControl - Perl extension for accessing a Conrad Electronic Relaiscard
$control = new Device::Conrad::RelaisControl("/dev/ttyS0");
$control->close(0,1); $control->open(0,1); $cardNum = $control->getNumCards(); $card = $control->getCard(0); $card->ports(255); $card->close(1); $card->open(1);
This module provides an abstraction layer for accessing a Conrad Electronic Relaiscard. It acts as a container for several cards (the cards are cascadeable) and controls the communication over the serial port.
At time of creation of the RelaisControl Object the serial port is initialized. It is the only operation which works without having a card attached to the serial port.
The init method communicates with the card(s) in order to figure out out how many cards are attached and what their status is. For every responding card a card object is assigned and is being put on the container list.
As this module is the container for any of the cards you can either switch port via absolute addressing or get a card object from the container and switch via this object.
will switch port 1 on card 0. The other approach is to get a card instance and operate on this
$card = $control->getCard(0); $card->close(1);
will get the same result as the command above.
Caution! The close() method activates the port (it closes the relais circuit). While it tend to be confusing I decided to name it this way round. General usage will look like: close(port); wait some time; open(port)
Only the RelaisCard's close() and open() methods are direct accesible through this module. Instead of delegating every card method i suggest working with the card objects if you need specific functionality.
None by default.
Norbert Hartl, <firstname.lastname@example.org>