Toggle Output
Toggle a boolean output state on the rising edge of a button input.
beginner
Parameters
| Name | Type | Usage | Description |
|---|
| In_Button | BOOL | Input | Button input signal to monitor for a rising edge. |
| Out_ToggledOutput | BOOL | Output | Output signal that changes state on each rising edge of the button input. |
Behavior
- Monitor the In_Button input for a rising edge transition from 0 to 1.
- When a rising edge is detected, invert the current state of Out_ToggledOutput.
- Update the internal state of LastButtonState to match the current In_Button input at the end of each scan.
Edge Cases
- Handle the initial scan where the input might already be at 1.
Constraints
- The transition must be detected within a single scan cycle.
Ready to start?
Open this exercise in Rungs Studio, write your solution, then click Test in the toolbar to verify your work against the built-in test cases.