06-05-2024 01:16 PM - edited 06-05-2024 01:18 PM
"(Also, your innermost case structure seems to only differ by two constants, so the DAQ should be after the case structure.)"
I dont quite understand what you mean here. The DAQ has to be inside the case structure for both TRUE and FALSE structures no?
In the 'TRUE' case, it sets the voltage to the red light to 2.5V, and green light to 0V.
In the 'FALSE' case, it sets the voltage to the red light to 0V, and green light to 2.5V.
There are two lights with separate power supplies, they can both be on at the same time if both supplied with voltage.
06-05-2024 01:33 PM
Is it possible to do this in a state machine? Like won't a state machine stop recording the data to CSV if you for example press a button?
06-05-2024 01:48 PM
@lorc34 wrote:
In the 'TRUE' case, it sets the voltage to the red light to 2.5V, and green light to 0V.
In the 'FALSE' case, it sets the voltage to the red light to 0V, and green light to 2.5V.
There are two lights with separate power supplies, they can both be on at the same time if both supplied with voltage.
In both case, you set both LEDs, just with swapped voltages. If you would place the two digital outputs after the case structure, you would only need one each, one for red (0 or 2.5V) and one for green (2.5 or 0V).
You don't even need a case structure:
This will light red or green, depending on the boolean input.
06-05-2024 02:10 PM - edited 06-05-2024 02:15 PM
I think I know what you mean, inside the 'TRUE' case it would be a value 2.5 and a value 0, and inside the FALSE case, it would be the same, with only two DAQ outputs outside. I suppose I can do that. Or no case structure at all.
Regardless I am struggling to understand how to do the timer thing in LabVIEW. I cant even do it in a basic VI, excluding all the other crap.
Here is my idea of it. I have implemented boolean buttons to act as the magnetometer data level and physical button push. When the magnetometer level exceeds, it gets the 'fail time'. Then it puts that into a shift register into the next loop to be compared to the current time. However, the value is still 'true' because this is the way I implemented the red light to be latched on until a button is pressed (GerdW gave me the solution to that). So therefore, it takes the old fail time and replaces it with the new one. I don't know how to have a variable where it is like 'okay the timer has started' and then, after the 30 seconds passed, it will have 'okay stop the timer'.
Then have that variable as a condition for starting the 'fail time'. If the variable is set to 'okay the timer has started', then it wont overwrite the 'fail time' in my head this is easy with a python script, you just set a variable 'start_timer' = started, verus stopped and have an if statement dependent on two variables, one is 'red light on?' and the other is 'timer already started?
06-05-2024 05:02 PM
@lorc34 wrote:
Here is my idea of it.
Sorry, we don't "do" pictures. Why not attach your VI attempt instead?
06-05-2024 05:34 PM
06-05-2024 05:50 PM
Hi Altenbach,
I actually manages to implement what I have been trying to do, in a dummy VI. This uses an express VI. when the level is exceeded and then quickly back to normal, the light stays red, and the timer will reset the light. if the level exceeded stays on, it won't reset the red light.
I am typing this on my phone via remote desktop so I can't look at your vi yet.
I will say I tried to implement this into the full VI (the one you looked at earlier) and it sort of works but has weird behaviour. instead of stopping when it hits 4 seconds and then starting at zero again if you hit 'level exceeded', it will start at like 8, or 12 seconds. despite only counting to 4. I think the DAQ assistant taking 1000 samples at 1000 hz, causing while loop iteration to be 1 second, may be messing with the express VI which is in the same while loop as it. I will attach that full vi tomorrow.
I have attached the dummy VI, the full VI is on a different pc I can't access but it works the same way, with the express vi just outside those two for loops, and the left shift register going to the select function you can see inside the inner for loop on previous VI.
06-06-2024 01:12 AM
Hi lorc,
@lorc34 wrote:
instead of stopping when it hits 4 seconds and then starting at zero again if you hit 'level exceeded', it will start at like 8, or 12 seconds. despite only counting to 4.
IN your example VI the ElapsedTime ExpressVI is set to count upto 5s and then auto-reset to start counting at zero again.
This does NOT fit to the description of the behaviour!
Why did you configure ElapsedTime to count upto 5s when you need to wait for only 4s?
06-06-2024 02:20 AM
Hi Gerd,
Because the boolean output "time has elapsed" wasn't working for me so I had to do it manually with the "elapsed time" number output
06-06-2024 02:27 AM
Hi lorc,
@lorc34 wrote:
Because the boolean output "time has elapsed" wasn't working for me so I had to do it manually with the "elapsed time" number output