Qwiic_Relay_Py  packaging_test1-1-g1022d62
Python for SFE Qwiic Relay
Loading...
Searching...
No Matches
qwiic_relay.QwiicRelay Class Reference

QwiicRelay. More...

Inheritance diagram for qwiic_relay.QwiicRelay:

Public Member Functions

def __init__ (self, address=None, i2c_driver=None)
 
def is_connected (self)
 Determine if the Qwiic Relay is connected to the system. More...
 
def begin (self)
 Initialize the operation of the relay. More...
 
def set_relay_on (self, relayNum=None)
 Turn's on a relay,if we're using a single relay, do not pass in a relay number. More...
 
def change_address (self, newAddress, singleRelay=True)
 Change the I2C address of the relay. More...
 
def set_relay_off (self, relayNum=None)
 Turn's off a relay,if we're using a single relay, do not pass in a relay number. More...
 
def set_all_relays_on (self)
 Turn's on all relays. More...
 
def set_all_relays_off (self)
 Turn's off all relays. More...
 
def set_slow_pwm (self, relayNum, pwmValue)
 Sets the value for the slow PWM signal. More...
 
def get_slow_pwm (self, relayNum)
 Gets the value for the slow PWM signal. More...
 
def get_relay_state (self, relayNum=None)
 Returns true if the relay is currently on, and false if it is off. More...
 
def get_version (self)
 Returns the firmware version for the Single Relay. More...
 

Public Attributes

 address
 

Static Public Attributes

 device_name = _DEFAULT_NAME
 
 available_addresses = _AVAILABLE_I2C_ADDRESSES
 

Properties

 connected = property(is_connected)
 
 version = property(get_version)
 

Detailed Description

QwiicRelay.

Parameters
addressThe I2C address to use for the device. If not provided, the default address is used.
i2c_driverAn existing i2c driver object. If not provided a driver object is created.
Returns
Object The Qwiic Relay device object.

Constructor & Destructor Documentation

◆ __init__()

def qwiic_relay.QwiicRelay.__init__ (   self,
  address = None,
  i2c_driver = None 
)

Member Function Documentation

◆ begin()

def qwiic_relay.QwiicRelay.begin (   self)

Initialize the operation of the relay.

Returns
bool Returns true of the initialization was successful, otherwise False.

◆ change_address()

def qwiic_relay.QwiicRelay.change_address (   self,
  newAddress,
  singleRelay = True 
)

Change the I2C address of the relay.

Parameters
The new address to change to
If we're changing the address of a single or quad relay

◆ get_relay_state()

def qwiic_relay.QwiicRelay.get_relay_state (   self,
  relayNum = None 
)

Returns true if the relay is currently on, and false if it is off.

Returns
bool Status of the relay

◆ get_slow_pwm()

def qwiic_relay.QwiicRelay.get_slow_pwm (   self,
  relayNum 
)

Gets the value for the slow PWM signal.

Can be anywhere from 0 (off) to 120 (on).

Parameters
The relay to get the PWM signal of
Returns
bool The value of the PWM signal, a value between 0 and 120

◆ get_version()

def qwiic_relay.QwiicRelay.get_version (   self)

Returns the firmware version for the Single Relay.

Returns
string The firmware version

◆ is_connected()

def qwiic_relay.QwiicRelay.is_connected (   self)

Determine if the Qwiic Relay is connected to the system.

Returns
bool True if the device is connected, otherwise False.

◆ set_all_relays_off()

def qwiic_relay.QwiicRelay.set_all_relays_off (   self)

Turn's off all relays.

This command does nothing for the single relay

Parameters
The relay to turn off
Returns
bool successful I2C transaction

◆ set_all_relays_on()

def qwiic_relay.QwiicRelay.set_all_relays_on (   self)

Turn's on all relays.

This command does nothing for the single relay

Parameters
The relay to turn on
Returns
bool successful I2C transaction

◆ set_relay_off()

def qwiic_relay.QwiicRelay.set_relay_off (   self,
  relayNum = None 
)

Turn's off a relay,if we're using a single relay, do not pass in a relay number.

Parameters
The relay to turn off
Returns
bool successful I2C transaction

◆ set_relay_on()

def qwiic_relay.QwiicRelay.set_relay_on (   self,
  relayNum = None 
)

Turn's on a relay,if we're using a single relay, do not pass in a relay number.

Parameters
The relay to turn on
Returns
bool successful I2C transaction

◆ set_slow_pwm()

def qwiic_relay.QwiicRelay.set_slow_pwm (   self,
  relayNum,
  pwmValue 
)

Sets the value for the slow PWM signal.

Can be anywhere from 0 (off) to 120 (on). A full cycle takes 1 second.

Parameters
The relay to set the PWM signal of
The value of the PWM signal, a value between 0 and 120
Returns
bool successful I2C transaction

Member Data Documentation

◆ address

qwiic_relay.QwiicRelay.address

◆ available_addresses

qwiic_relay.QwiicRelay.available_addresses = _AVAILABLE_I2C_ADDRESSES
static

◆ device_name

qwiic_relay.QwiicRelay.device_name = _DEFAULT_NAME
static

Property Documentation

◆ connected

qwiic_relay.QwiicRelay.connected = property(is_connected)
static

◆ version

qwiic_relay.QwiicRelay.version = property(get_version)
static

The documentation for this class was generated from the following file: