Detects a rising edge (FALSE-to-TRUE transition) on a monitored input and produces a single-cycle pulse on the action's output variable.
The R_TRIG instruction watches the boolean variable passed as its operand for a rising edge - the moment that signal transitions from FALSE to TRUE. When the edge occurs, the action's name (the output variable) is set to TRUE for exactly one scan cycle, then returns to FALSE.
Two distinct variables are involved:
name - the output variable. Pulses TRUE for one cycle on each rising edge.operands[0] - the input signal monitored for the rising edge.This is useful when you need to trigger an action only once at the moment a condition becomes true, rather than continuously while it is true.
Typical uses include:
R_TRIGrequires the input operand. Without it, the instruction has nothing to compare against and the output never pulses. The Sequence visual editor and the runtime both warn when the operand is missing.
R_TRIGis often confused with theActionQualifier.P(pulse on step activation) qualifier, but they serve different purposes.R_TRIGis an instruction-level edge detector on a signal, whileActionQualifier.Pis a qualifier-level pulse on step activation.
ActionQualifier enum (default: ActionQualifier.N)ActionInstruction.R_TRIG[ActionOperand("input_signal")] - the boolean variable to monitor{GIF:HERE} - Screenshot showing a step named "StepName" with an action on "edge_var" using the R_TRIG (rising edge detection) instruction, with the watched input variable specified in the operand field
from automation_machine import Sequence, StepType, ActionInstruction, ActionOperand
class Example(Sequence):
def setup(self):
step = self.add_step(StepType.INITIAL, name="StepName")
# `edge_var` pulses TRUE for one cycle whenever `input_signal` goes 0 -> 1.
step.add_action(
"edge_var",
"Rising edge of input_signal",
instruction=ActionInstruction.R_TRIG,
operands=[ActionOperand("input_signal")],
)
# Reference the output in a transition condition:
# self.add_transition(step, next_step, "edge_var")