05-02-2023 03:37 PM
@govindsankar wrote:
@Jay14159265, thank you for the advice, but actually I am learning actor framework. That is the idea. So I start with QMH, then I move onto OOP. Both QMH and OOP I know the concept, i need to practice it. So thats what I am doing now. Once I have mastered both, I will start actor framework. It was my idea all along to learn actor framework.
That is great to hear! I think you are on a good learning path.
05-03-2023 03:43 AM
Thank you very much Ravi. Finally I have been able to understand how to do QMH. I always knew the basics of it but never understood how to differentiate between the loops. Because when I send a message all loops responded. This was my problem in the past. Finally I understood how to solve it. Thank you. Today morning I did another simple program. Like a fun program I played with using QMH. There is a counter that goes from 0 to 10. There are 3 LEDs and if value is from 0 to 3 Ok Led is on, between 4 and 7 then Warning Led is On and between 7 and 10 Danger Led is on. These LEDs can be switched on manually as well. By sending a message like Warning LED on. Also there are 3 push buttons to turn on each of the LEDs. Pressing a push button turns on its appropriate LED for 5 seconds and goes back to the initial state. Both Manual Operations will only work if the counter value is below 4. This was just a fun program I created. I have attached it. You can have a look if you want. But once again thanks Ravi.
05-03-2023 04:10 AM
Hi govindsankar,
just looked in your code and saw the Stop and timeout, as of your timeout does nothing but to read the Stop-button, move the Stop-Button in the stop Event and remove the timeout, then your event while loop only does something if an event is happening.
Idea for learning, make the 3 selector buttons not use a 5 sec timeout.
greetings
Timo
05-03-2023 07:43 AM
Hi Govind, I'm glad it helped. Celebrate each little success. You're on the right path.
As @t.n14 suggested, you don't need a timeout in an event structure unless you want to do some periodically.
Also, you probably noticed that when you click the Increment/Decrement buttons, they stay "On," and only when you click them again, do they turn "Off". For starters, please put these buttons in their respective event cases and see the correct behavior. Also, spend some time learning about the button "Mechanical Action" (right-click menu).
05-03-2023 07:48 AM
@Ravi, yeah I noticed that problem with increment decrement button. I didnt give it much thought because i thought that was not important for this tutorial. But you are right, I need to find out why. I did use latch until released. So not sure why its stays on.
05-03-2023 08:23 AM
It stayed on because a latched button must be read for it to release the latch. Since the buttons are just hanging out outside the event cases, they are only read once at the beginning and never again. If you move the buttons to their respective cases, they will be read on value change, which will set them back to off.
Also, experiment with "Panel Close?" event for stopping the VI. Stop buttons are hardly used in mainstream applications. Based on their experience with most apps/applications, users are used to using the Window close button. It also makes your front panel a bit cleaner by removing one redundant button.
Try using all (at least most) controls/indicators from one palette. System controls palette is generally a safe bet, but if you prefer Modern or NXG, go for it. But stick to mostly one. Your UIs will look better put together.
05-03-2023 08:28 AM
I don't know about anyone else here, but I think this is an awesome topic. Great two-way communication between OP and group to achieve real learning. Self-improvement is a great reason for being here!
05-03-2023 08:43 AM
@Ravi or @govinsankar, can one of you help me understand how you get the queue refnum in the cluster as shown below? I also want to learn.
05-03-2023 08:47 AM
How I did it was create four queue constants, named each of them and placed them in a cluster constant. So the output wire from the obtain queue, I right click on it and select create constant. This will create a queue constant. And I named the first one counter and so on.
05-03-2023 08:50 AM
@GRCK5000, you can just create an empty cluster constant/control (or add to an existing cluster). Create the queue or any other reference, create a constant from that reference, and just copy or drag-drop that reference into the cluster.