low
Sets the output value to false.
func low()
low()
and write(false)
work the same way, and this is more straightforward.
Sets the output value to false.
func low()
low()
and write(false)
work the same way, and this is more straightforward.
import SwiftIO
The SwiftIO library allows you to access and control the hardware in an easy way.
final class DigitalOut
The DigitalOut class configures a specified pin as a digital output pin and set its state (high or low output).
func write(_ value: Bool)
Sets the output value of the specific pin: true
for high voltage and false
for low voltage.
func high()
Sets the output value to true.
func toggle()
Reverses the current output value of the specific pin.
func getValue() -> Bool
Gets the current output value in Boolean format.
init(_ idName: Id, mode: Mode = .pushPull, value: Bool = false)
Initializes a DigitalOut to a specific pin.
var mode: Mode { get set }
The current output mode: .pushPull
or .openDrain
.
let obj: UnsafeMutableRawPointer
var value: Bool { get set }
The current state of the output value. Write to this property would change the output value.
func getMode() -> Mode
Returns the current output mode in a format of Mode
enum.
@discardableResult func setMode(_ mode: Mode) -> Result<(), Errno>
Sets the output mode: .pushPull
or `.openDrain.
enum Mode
The Mode enum includes the available output modes.