hw_ctrl()

Returns the state of the control port ()ctrl or an individual control pin on that port.

First control pin has index 1.

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

Syntax

planetcnc.hw_ctrl()
planetcnc.hw_ctrl(index)

Parameters

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

Return Value

Examples

#! /usr/bin/env python
 
import planetcnc
 
# Get the complete control port state
full_ctrl = planetcnc.hw_ctrl()
print("Full Control State:", full_ctrl)
 
# Get the state of the first control pin
ctrl1 = planetcnc.hw_ctrl(1)
print("Control pin 1 state:", ctrl1)

See also