06-04-2018 09:22 AM
Hi all,
I have just inherited a terrifying VI (first VI attached) from my supervisor - it is supposed to run a clock (with just the seconds arm on screen (starting the arm from a random seconds position i.e., not 12 oclock every time). The arm spins around until a user presses a button. Then a beep plays. Then the user can enter where they thought the clock arm was when the beep played.
This code has been used and abused by various previous students adding things, and I am trying to dilute it down to its purest form (clock start, button press, enter response), but am having trouble.
I tried to just pull the clock itself out (second VI) to start with, but the arm only cycles around the first quarter of the clock and then jumps back and starts again at 12...
Does anyone have any idea why this might be happening? Maybe I missed some 'continuation' code that gets it to keep spinning, but I can't see the wood from the trees in the parent VI...
Thank you for any help!
Solved! Go to Solution.
06-04-2018 10:12 AM - edited 06-04-2018 10:13 AM
just replace wire and set correct limits values
06-04-2018 10:23 AM - edited 06-04-2018 10:25 AM
Without looking at your code, and without writing any code myself, let me try to "walk you through" the Clock problem.
I urge you to try doing this on your own before you look at the code others might post for you. You'll learn much more this way.
Bob Schor
P.S. -- I agree that the other code is Frightening.
06-05-2018 02:54 AM
Hi Artem.spb,
Thank you for your reply and the useful picture - however, weirdly, when I rewired lower output to 'clock' and upper output to 'clock2' the clock arm now just does not move at all...
I saw your other note about 'set correct limits value' do you mean the '60.00'? I see in your image that yours looks like it has a comma (60,00) not a decimal point (60.00), as mine has. I tried to enter a comma between but it wouldn't let me...
Sorry to be such a dunce but the issue is I don't really understand what that bit of code does (R / IQ), I looked it up but still fail to understand as I am mathematically illiterate 😞
06-05-2018 03:13 AM
Hi Bob, thanks for your feedback, to answer your questions:
I urge you to try doing this on your own before you look at the code others might post for you. You'll learn much more this way.
I agree, normally I would hack away at this on my own but this is part of a larger project that I have 5 months to deliver, and 3 months have already expired :s (thanks for your comments on some of the other, accelerometry related, parts of the project Bob - that section seems to have come along well, I am planning on posting the solution to the forum within the next day or two so others can see if they are interested!)
I will have a go at this when I get in to work but any more hints would be amazing!
06-05-2018 03:14 AM
I also tried this
https://forums.ni.com/t5/Example-Programs/Creating-an-Analogue-Clock-Using-Gauges/ta-p/3511908
Removing all arms but the second arm, and playing around with the numbers to get it to move faster. But when I removed the other arms, the seconds hand got stuck again... does it need the other arms to work properly? that seems weird...
06-05-2018 05:15 AM
why you ignore my message?
You have 2 (3) arms, but only one with scale. Another scale(s) hidden. You need show scale for all arms and set correct ranges.
In your vi the second arm ("ms") has range 0..2400, and get values 0..600. This is reason why it moves in first quarter only.
06-05-2018 08:13 AM
Hi Artem,
I did reply 😄 (see comment above)
Though that comment is not needed now as the clock rotates! I feel silly not realising that clock resolution meant how far around the arm would go.
Setting it to 2400 made it rotate all the way around, but it was jumping at the end. So I figured maybe I had not sufficient rotations in there for the other values, and set clock resolution to '2560' to match the other number being divided there, and it looks much better!
How come you suggested wiring the divided output to 'clock' instead of 'clock2'? this seems to make the arm get stuck on 60. No matter though, the other way around works!
😄
So happy thank you!