hw_limit()

Returns the state of the limit port or an individual limit switch on that port.

First limit switch has index 1.

When the index is omitted or set to -1, returns the entire limit value.

Syntax

planetcnc.hw_limit()
planetcnc.hw_limit(index)

Parameters

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

Return Value

Examples

#! /usr/bin/env python
 
import planetcnc
 
# Get the complete limit port state
full_limit = planetcnc.hw_limit()
print("Full Limit State:", full_limit)
 
# Get the state of the first limit switch
limit1 = planetcnc.hw_limit(1)
print("Limit switch 1 state:", limit1)

See also