RC Groups - View Single Post - FRSKY Taranis "How to" Thread
Capturing a double-pull of a momentary switch
Thought I'd share this snippet for capturing a double-pull of a momentary switch. Applications include anywhere a 'safe' switch is required, for example for arming a motor or u/c operation.
Operation:
Pull SH twice within a 1.5 second window. The second pull is captured as an edge in L3.
Code
Operation:
Pull SH twice within a 1.5 second window. The second pull is captured as an edge in L3.
Code
L1 Edge(L02, [0:instant]) Duration(1.5s)
L2 ( Edge(SH-down, [0:instant]) )
L3 L01 AND L02
How it works
- Pulling SH generates an edge in L2, which cascades to L1 a clock tick later.
- Because an edge is true for just a single clock tick, L3 is true only from the second pull. This must be within the time period set in L1.Duration (1.5 secs).
Simple demo - each double-pull toggles a sticky switch:
L4 Sticky(L03, L03)
No comments:
Post a Comment