Relay

Python Library for Solid State Relays.

Python Library

Turta_Relay library is responsible for controlling solid state relays.

Initialization

Add the following statement to the top of your Python code.

from turta_iothat3 import Turta_Relay

Then, create an instance of the RelayController class.

relay = Turta_Relay.RelayController()

Now you're ready to access the library by calling its instance.

Basic Members

Write (Control) Relay

Controls the relay.

write(ch, st)
  • Parameters

    • Byte ch: Relay channel. (1 or 2.)

    • Bool st: Relay state. (True or False.)

  • Returns

    • None

Toggle Relay

Inverts the relay's state.

toggle(ch)
  • Parameters

    • Byte ch: Relay channel. (1 or 2.)

  • Returns

    • None

Read Relay State

Reads the relay state.

read(ch)
  • Parameters

    • Byte ch: Relay channel. (1 or 2.)

  • Returns

    • Bool: Relay state. (True or False.)

Finalizer

When exiting from the program, the library turns off the relays and then releases the GPIO pins.

Last updated