05-14-2022 04:45 AM
Hello to everyone. I realize I'm asking a pretty easy question, but I've looked at all the examples. AND I am very confused. What I want to do is briefly this: I want to move a directional valve.
15 sec False-False (stop)
10 seconds True-False (up)
15 sec True-False ( down)
next; False-False should stay
Solved! Go to Solution.
05-14-2022 09:38 AM - edited 05-14-2022 10:16 AM
You need a simple "State machine" with four main states: idle, wait, up, down
What's the difference between "True-False (up)" and "True-False ( down)". How do we know the difference?
Are there any timing precision requirements? Do you want to update and display elapsed time for each state? Should it be interruptible at any time?
05-14-2022 10:42 AM
Sir first of all thank you for your reply.
Are there any timing precision requirements? - No sir
Do you want to update and display elapsed time for each state - Yes
What's the difference between "True-False (up)" and "True-False ( down)". How do we know the difference?
-The program I am currently writing does exactly what I want. But I think there may be an easier way to do this.
05-14-2022 10:43 AM
05-14-2022 10:47 AM
This is exactly what I was looking for, thank you. 🙂 🤗😎
05-14-2022 10:52 AM
@emre_ wrote:
-The program I am currently writing does exactly what I want. But I think there may be an easier way to do this.
Some glaring flaws:
What's the purpose of the triangle button. That was not described. To be able to manually control the LEDs in the idle state, it would be easy to modify my code accordingly.
05-14-2022 11:04 AM
You need to set a reasonable loop rate using a wait function.
-you are right sir , I should add that.
What's the purpose of the triangle button. That was not described. To be able to manually control the LEDs in the idle state, it would be easy to modify my code accordingly
I operate the valves in two different ways.
triangle mod --> up-down-up-down ( repeat)
normal mode--> up or down
05-14-2022 11:24 AM
@emre_ wrote:
I operate the valves in two different ways.
triangle mod --> up-down-up-down ( repeat)
But UP/DOWN is a control! So it does not cycle "up-down-up-down ..." under program control.
If you want to have a way to do up or down manually while the code is idle, I would do something as follows:
05-14-2022 11:37 AM
I understand better now. Thank you again for this. I edited a little.it was exactly what i needed.😊👍
05-17-2022 04:03 AM
hello sir, you replied yesterday.
I have been working on this issue for 2 days.
I need to add one last thing.
Is it possible to program a program that repeats this process n(5) times?