NAME

Device::ProXR::RelayControl - A subclass of Device::ProXR object for relay control.

VERSION

Version 0.06

NOTES

* Before comitting this file to the repository, ensure Perl Critic can be invoked at the HARSH [3] level with no errors

SYNOPSIS

use Device::ProXR::RelayControl;

my $board = Device::ProXR::RelayControl->new(port => qq{COM2});

$board->all_off;
$board->relay_on(1, 1);

SEE ALSO

See Device::ProXR for attributes and methods of the base class.

ATTRIBUTES

METHODS

get_mode()

Description

Returns the current mode of operation

Parameters

NONE

Return

Value indicating run mode

relay_on($relay)

relay_on($bank, $relay)

Description

Turn on the relay

Parameters

$bank - Bank number of the relay to control (1 based) $relay - Relay number of the relay to control (0 based)

Return

UNDEF on error (with last_error set)

NOTE

If only one parameter is specified, it is treated as a 0 based relay number and the bank is calculated as (relay / 8) + 1, and the relay within the bank is caluclated as (relay % 8)

relay_off($relay)

relay_off($bank, $relay)

Description

Turn off the relay of the specified bank

Parameters

$bank - Bank number of the relay to control (1 based) $relay - Relay number of the relay to control (0 based)

Return

UNDEF on error (with last_error set)

NOTE

If only one parameter is specified, it is treated as a 0 based relay number and the bank is calculated as (relay / 8) + 1, and the relay within the bank is caluclated as (relay % 8)

relay_status($bank, $relay)

Description

Get the status of the relay of the specified bank

Parameters

$bank - Bank number of the relay to control $relay - Relay number of the relay to control

Return

UNDEF on error (with last_error set) 0 == Relay is OFF 1 == Relay is ON

relay_control($on, $relay)

relay_control($on, $bank, $relay)

Description

Turn the relay on or off

Parameters

$on - Indicates if the relay should be turned on or off $bank - Bank number of the relay to control (1 based) $relay - Relay number of the relay to control (0 based)

Return

UNDEF on error (with last_error set)

NOTE

If only two parameters are specified, the second parameter is treated as a 0 based relay number and the bank is calculated as (relay / 8) + 1, and the relay within the bank is caluclated as (relay % 8)

all_on()

Description

Turn on all relays on all banks

Parameters

NONE

Return

NONE

all_off()

Description

Turn off all relays on all banks

Parameters

NONE

Return

NONE

bank_on($bank)

Description

Turn on all relays on the specified bank

Parameters

$bank - Bank number of bank to control

Return

NONE

bank_off($bank)

Description

Turn off all relays on the specified bank

Parameters

$bank - Bank number of bank to control

Return

NONE

bank_invert($bank)

Description

Invert the status of all relays on the specified bank

Parameters

$bank - Bank number of bank to control

Return

NONE

bank_reverse($bank)

Description

Reverse / mirror the status of all relays on the specified bank

Parameters

$bank - Bank number of bank to control

Return

NONE

bank_status($bank)

Description

Return a byte with the statTurn on all relays on the specified bank

Parameters

$bank - Bank number of bank to control

Return

SCALAR - Each bit represents relay 0-7 status

AUTHOR

Paul Durden <alabamapaul AT gmail.com>

COPYRIGHT & LICENSE

Copyright (C) 2015 by Paul Durden.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.