Join us today!
[Solved] Momentary Push Button and LED - Programming Challenge
You have one momentary push button and one LED. When you press the push button and let it go once, LED will turn on and stay on. When you press and let it go again, LED will turn off and stay off. Your push button input is HIGH only when you are pressing it, it is a momentary push button so it does not hold its state when you release the button. You can only use ladder logic with maximum 3 rungs/networks and no math function blocks are allowed.
Share your answer with the community ! 🧐
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
@twincontrols What is the difference between this concept and a toggle button?
In a Toggle Button, you would usually use a one-shot. In TwinCAT, there is nothing that is referred to as a one-shot, but there is something similar called a Command-Edge Detection in TwinCAT
https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_plc_intro/2532295307.html&id=
Is this the same thing?
@joris I tried it yesterday and it did not work. I looked at it again this morning and realized I should be checking the status of the LED when the PB is pressed (not the status of the PB!). Attached is my corrected solution.
@ehixenbaugh You can think of one-shot in RS5000 studio as R_TRIG in TwinCAT. Or adding an edge detection to a contact in ladder logic with the 'P' symbol.
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
@twincontrols Ok, Thanks! This actually makes more sense to me in TwinCAT then in Studio 5000 because usually when I am one-shotting in a rung, it is for one particular bit. I don't like seeing in someone's code when they have more than one input and there is a one-shot that succeeds those inputs.
Great idea on the forum topic! This seemed simple at first, but surprisingly took some brain power to work it out.
@time2learn Great job at solving it using only one rung! 👍 It does sound simple and easy when you're reading it indeed 😀 It just requires a bit thinking.
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
@alex Interesting. Could you try again?
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
@alex You almost got it right! It seems that your pushbutton doesn't clear itself after you set it TRUE. In the code, you'd need to clear Pushbutton variable also to demonstrate the full simulation experience.
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
@twincontrols, sorry missing something.
When Pb is pressed it should be On, when PB is released it should be Off.
Without Set Reset
@joris It is nice seeing a solution in TIA Portal too! 🙂 Nice and clean! Maybe you could solve it using only one rung too!
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
I like to use XOR for those use cases. Logically similar to the TIA solution from above, but imho easier to read.
-
Array Comparison
2 years ago
-
Measuring the scan cycle of PLC
2 years ago
-
Traffic Simulation
2 years ago
-
Adjustable Flowing LEDs - PLC Programming Challenge
2 years ago
-
Custom Flash Timer
2 years ago
- 17 Forums
- 267 Topics
- 924 Posts
- 0 Online
- 737 Members