hello,
I am using Push button in a spring effect.
I want to control a LED with this input.
If Once I press that button output should be on on LED and second time press,It should OFF and so on....
Please give me logic 4 it...
Thank you.
Hi,
Take a look at this.im sure it will help
Dear omprakash,
I believe this is not full proof way, beacuse when LED local variable is FALSE & inpyt is TRUE, the LED will be TRUE & the same value will bepassed to its local variable.
Now if switch remains TRUE & LED is TRUE so LED will get OFF.
This condition will arrive when the processor is loaded & execution gets slow. Always avoid this.
Hi kekin,
Nice one.common thing is we both used local variable![]()
Hi kekin,
Im not getting in particular what you are trying to say.
please give some real time example or a vi
Your code will work only if LOCAL VARIABLE gets updated before the switch goes from TRUE to FALSE.
If LOCAL VARIABLE does not get updated before the input switches to FALSE then ur code will not work. You have dependecy here & this error can happen randomely at any time.
F-->False , T-->True & LV-->Local variable of LED.
For example, initially:
1.LED=F , LV=F & INPUT=F.
2.PRESS INPUT
3.INPUT=T & LV=F so LED=T
4.Now if LV is not updated first then.
5.INPUT=F & LV=F so LED=F.LED will never turn ON.
This can happen.Hence your code will work only if LOCAL VARIABLE gets updated before the switch goes from TRUE to FALSE.
Kudos are welcomed.:-)
Hence I have edited your code to make it FULL PROOF.
Here for writing to localvariable LED it takes time.Iagree
But in my vi im only reading from output LED
i.e
Here as the output changes local variable will change with it.
Because both share the same memory space.
Dear Omprakash,
If you search on LOCAL VARIABLE, then u will find that each local variable (whether READ or WRITE/ CONTROL or INDICATOR) is assigned seperate location & is updated after some time.
Local variables always chage after the CONTROl or INDICATOR changes.
Fastest is CONTROL & INDICATOR
Next is Local variables &
Slowest are Property Nodes.
Read following article to clear ur CONCEPTS:
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019N6nSAE&l=en-US
http://digital.ni.com/public.nsf/allkb/37002ACC84B961CA86256D9C00760EE2
and last but not least:
Hope this clears my POINT.
I cannot explain more on that.