hw_output()

Returns state of output port or individual pin on that port.

First pin has index 1.

When index is omitted or set to -1, returns the complete output value.

Syntax

planetcnc.hw_output()
planetcnc.hw_output(index)

Parameters

Parameter Type Description Comment
index int Optional pin index. First pin is 1. Omit to return full output. optional

Return Value

Examples

#! /usr/bin/env python
 
import planetcnc
 
# Get the complete output port state
full_output = planetcnc.hw_output()
print("Full Output:", full_output)
 
# Get the state of the first pin
pin1_state = planetcnc.hw_output(1)
print("Pin 1 state:", pin1_state)

See also