|
Re: How to program a button this way?
In the text language, the Boolean variable would need to be static or global in order to keep its value from call to call. That serves the same purpose as the feedback node. It remembers state data in a scope that is longer lived than the function call.
In a text language, the local variables, and in LV, the wires, have a short-lived scope that is cleared each time the function is called. They are temporaries.
FYI, you can actually make global variables in LV too, so if you don't get the hang of the feedback node, try with globals. But the feedback node or shift registers are a somewhat safer and more controlled language feature, like static local variables are in C, etc. So it is good to learn how to use them.
Greg McKaskle
Last edited by Greg McKaskle : 17-02-2013 at 07:51.
Reason: commas
|