How would I go about programming a window motor to run for only a certain amount of time. To be more specific I’m trying to make it that when you click a button, it turns on that window motor for a certain amount of time like 1 second then it shuts off, and if I were to hold this button down then the window motor would just keep running. Please provide a example if you have one. Thxs in advance
Do it in two parts. The first part is to read the button, and whenever the button is pressed set a value to be one second in the future. Leave the value alone when the button is not pressed. The second part is to compare the current time to that value, turn on the motor whenever the value is in the future, and turn off the motor whenever the value is in the past.
I figure you’ll have some specific questions to ask now. I’m willing to give specific answers to them. Ask away!
Are there any examples you can direct me to? I understand what you explained the hard part would be implementing it in Labview, since I’m still learning as I go.
Here’s an example. It’s a VI snippet, so you can just drag it into a LabVIEW block diagram and it’ll be live code. It’s designed to drop into Teleop. Change the RefNum names to match what you opened in Begin.vi.
The motor will run when the button is pressed, and it will continue running for one second after the button is released. If that’s not what you wanted, there are a couple of simple modifications that can change the behavior.