LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Toggling Solenoids for automatic forward/reverse

So I already have a toggle switch built, works fine with a motor. (Latch Launcher in attachments)

 

But I'm having an issue with it, I can only currently hold the button to make the solenoid go forward, and then on release let it go reverse.

But I want to make it so that you just press a button once and the solenoids will go forward, then backward, not allowing the button to interfere during the process.

 

I have a latch gate put in, but I cannot "reset" the latch gate as it's latched boolean value goes to the case structure and sending a true from the second sequence nulls the wires.

 

One would think to use shift registers, but the process can't be interfered with, and it has to do two actions.

 

Here is what my code looks like:

 

 

 

 

 

 

 

0 Kudos
Message 1 of 13
(3,597 Views)

Hi Arkacaro,

 

the cleanup button is not a friend of yours, isn't it? 😄

 


But I want to make it so that you just press a button once and the solenoids will go forward, then backward


 

Put another SetSolenoid function call into your case structure, now setting the solenoid to backward...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 13
(3,580 Views)

But how does the function decide when to reverse? Wouldn't it then execute both functions at the same time? Thus rendering it null?

 

This is what I got out of adding another SetSolenoid function:

 

Thank for the reponse 🙂 and no, me and the cleanup button don't associate anymore. Not after that project. ;D

0 Kudos
Message 3 of 13
(3,572 Views)

Hi Arkacaro,

 

for the block diagram shown in your post you definitely should apply cleanup, it could reduce BD size to about a quarter...

 

Well, I didn't suggest to delete the wait function between switching the solenoid forth and back! From your first post I suspected you need to switch forward, then wait a little amount of time and then switch backward. Isn't that what you want?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 13
(3,569 Views)

It actually is cleaned, just that I wasn't sure whether or not to have the orange latch gate there or not, and I didn't take out the other stuff so it didn't look like it was "just" for solenoids.

 

I actually tried that beforehand, which was originally what I thought would work, but case structures switch execution to whatever state depending on the input. So in order for all of that to function, you would have to hold down the launch button, and if you let go, you have to manually reset it or do the entire process over again.

 

I have a little latch node in there, that once it receives a true signal, makes the output true forever until a true to a reset on it is detected. Basically my idea is once you hit the trigger it does it's process without any sort of interruption and then resets the latch node so that you can run it again and the process starts over.

 

But as you can see in the image below, if you try to wire a "true" function to it from the same connections, the wire becomes invalid.

 

0 Kudos
Message 5 of 13
(3,563 Views)

Hi Arkano,

 

you can't have "loops" in your wires: the case structure is getting input and sending output to the same other structure (your latch) - that's not possible using dataflow paradigm! Use a shift register to send case structure output to the latch...

 


which was originally what I thought would work, but case structures switch execution to whatever state depending on the input


 

Yes, case structure reacts on selector input. But once you enter the case structure you will leave it only after processing all of the functions inside! So your switching process (forward, wait, backward, wait) will be executed - no matter how often you hit the button in between!

 


It actually is cleaned


 

I really doubt that! All those bent wires...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 13
(3,554 Views)

Oh, I have a organized version somewhere, just that I thought you meant "clean" as in get rid of redundant or uselessly hooked up stuff.

 

So if I were to wire a button to it the case structure with a sequence structure inside as is shown above, the moment I hit the button it will process everything inside of the sequence structures until it's finished? So it basically

latches itself until everything is done? If so, that pretty much solves everything, doesn't it?

0 Kudos
Message 7 of 13
(3,550 Views)

Hi Arkacaro,

 

when you set the button to "Latch..." mode: yes that pretty much will solve everything you asked for.

 

Meanwhile: THINK DATAFLOW! 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 13
(3,544 Views)

when you set the button to "Latch..." mode: yes that pretty much will solve everything you asked for.


 

 

Set the button to "Latch..." mode? Previously as stated I can't make the dataflow loop, do you mean just have a normal button from a joystick to the ? condition terminal as how I have it on all the pictures?

As far as I know, buttons don't automatically latch, so i'm not quite sure what you're talking about if it's not that. 😛

0 Kudos
Message 9 of 13
(3,542 Views)

Hi Arkacaro,

 

I'm sorry, I thought about buttons on the VI front panel while you're using buttons of a joystick attached to your PC. Forget about that...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 13
(3,540 Views)