Links
Comment on page

Digital

Python Library for Digital IO Ports.

Python Library

Turta_Digital library is responsible for setting and getting GPIO pin states of the digital ports.

Initialization

Add the following statement to the top of your Python code.
from turta_lorahat import Turta_Digital
Then, create an instance of the DigitalPort class.
digital = Turta_Digital.DigitalPort(True, True, True, True)
Now you're ready to access the library by calling its instance.

Initialization Parameters

DigitalPort

Initiates the GPIO pins.
Turta_Digital.DigitalPort(d1In, d2In, d3In, d4In)
  • Parameters
    • Bool d1In: Pin 1 direction. (True for input, False for output, True is default.)
    • Bool d2In: Pin 2 direction. (True for input, False for output, True is default)
    • Bool d3In: Pin 3 direction. (True for input, False for output, True is default)
    • Bool d4In: Pin 4 direction. (True for input, False for output, True is default)

Basic Members

Read Input Pin

Reads the digital input.
read(ch)
  • Parameters
    • Byte ch: IO Channel. (1 to 4.)
  • Returns
    • Bool: Pin input state. (True for high, False for low.)

Write Output Pin

Sets the digital output.
write(ch, st)
  • Parameters
    • Byte ch: IO Channel. (1 to 4.)
    • Bool st: Pin output state. (True for high, False for low.)
  • Returns
    • None

Toggle Output Pin

Inverts the digital output.
toggle(ch)
  • Parameters
    • Byte ch: IO Channel. (1 to 4.)
  • Returns
    • None

Finalizer

When exiting from the program, the library releases the GPIO pins.