The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

VERSION

Version 0.03

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(qq{COM2});
  
  $board->all_off;
  $board->relay_on(1, 1);
  

ATTRIBUTES

METHODS

get_mode()

Description

Returns the current mode of operation

Parameters

NONE

Return

NONE

relay_on($relay) =head2 relay_on($bank, $relay)

Description

Turn on the relay

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)

NOTE

If only one parameter is specified, it is treated as a zero based relay number and the bank will be determined by dividing by 8, and the relay within the bank will be the remainder of dividing by 8

relay_off($relay) =head2 relay_off($bank, $relay)

Description

Turn off 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)

NOTE

If only one parameter is specified, it is treated as a zero based relay number and the bank will be determined by dividing by 8, and the relay within the bank will be the remainder of dividing by 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

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.