Join us today!
[Solved] Adjustable Flowing LEDs - PLC Programming Challenge
The goal is to create adjustable flowing LEDs PLC program. You will have 16 LEDs total. Users will provide how many flowing LEDs they want, the minimum and maximum flow time from one end to the other and they will be able to control the speed on the fly.
-Max 15 flowing LEDs are allowed.
-Start button is used to start the program when all the settings are provided by the user.
-If a user enter 5s for the slowest time and set the speed bar to 0%, it will take LEDs to flow 5s from one end to the other.
-If a user enter 1s for the fastest time and set the speed bar to 100%, it will take LEDs to flow 1s from one end to the other.
A running program can be seen in the video below. You need to write the PLC logic for this HMI, but you are welcome to develop the HMI program as well.
Share your implementation with the community! Good luck and happy coding! 😊
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/
Here is my solution. Attached is a video and pictures of my code, as well as a link to the archive with my project in it
https://github.com/evanhixenbaugh/TwinCAT-Projects/blob/main/AdjustableFlowingLEDs_ehixenbaugh.tnzip
- Evan H.
@ehixenbaugh Great job and you even did the HMI part as well!! In the video, when you selected 2 and 1 Led, it seems like Led doesn't flow one by one, it appeared to be jumping, I am not sure if it's because of the video or something else.
Well done!!
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 Its not the video, but I think the HMI program. When you look at the array of BOOLs that represent the output LEDs in the MAIN program, it functions normally. I notice that the change of LEDs look a lot less smooth when the program is running at a really fast speed (~1 s). At that speed, it looks like LEDs are skipping over on the HMI screen. I don't know if there is a feature for increasing refresh rate on the HMI or what.
@ehixenbaugh That's right. You'd need to change your HMI Response. This might help you:
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/
@ehixenbaugh I'm not really sure that is an HMI issue, I think it's your code.
I have 2 questions:
- Why did you a delay off line 18?
- In normal mode when i_index >0 your piece of code manage only 1 led each PLC's cycle, why not all in one cycle?
My take on the challenge, made in ST in Siemens TIA.
Feedback on code is appriciated... 🙂
- Jesper Thygesen
@jthyge Thanks for sharing! From my understanding, each PLC cycle you're clearing your whole array, then filling your LED array again with using the current led position and the number of the flowing LEDs. I think it would work as well, however we wouldn't want to turn on the each LED one by one for this application. Let's say we have 5 flowing LEDs, we want to turn on the first 5 LEDs at the same time, then flow them together by one. You could maybe look at the shift registers in TIA 🙂
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 Thanks for your comment.
"Clearing and filling" the array is done in one PLC cycle, so the LEDs are not turned on one by one.
@jthyge That's correct! What I meant is there might be an alternative way without needing to clear everything, then fill each PLC cycle. Your code looks clean and organized!
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/
Siemens Version. No HMI
@joris Works really well! Great job! Would you mind sharing your implementation or screenshots from your code with the community when we have a few more answers?
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/
Really nice to all
@joris Thank you for sharing your implementation! Well done!!
Let's say if the customer is not sure about the total number of the LEDs at the beginning, how would you design your program today so that you won't have to change a lot of things when the customer wants to have N number of LEDs or N set of N number of LEDs in the future ? 🙂
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/
-
Array Comparison
2 years ago
-
Measuring the scan cycle of PLC
2 years ago
-
Momentary Push Button and LED - Programming Challenge
2 years ago
-
Traffic Simulation
2 years ago
-
Custom Flash Timer
2 years ago
- 17 Forums
- 267 Topics
- 924 Posts
- 1 Online
- 737 Members