Comment on page
Digital
Python Library for Digital IO Ports.
Turta_Digital library is responsible for setting and getting GPIO pin states of the digital ports.
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.
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)
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.)
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
Inverts the digital output.
toggle(ch)
Parameters
Byte ch: IO Channel. (1 to 4.) Returns
None
When exiting from the program, the library releases the GPIO pins.
Last modified 4yr ago