|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: button Switch
This is actually a really simple issue for programming. The exact implementation depends on your programming environment. Here is how you would do it in C/C++:
Code:
bool motorIsRunning = false
...
if (theButton == PRESSED)
{
motorIsRunning = !motorIsRunning;
}
...
if (motorIsRunning)
{
motorValue = FULL_FWD;
}
else
{
motorValue = STOP;
}
Good luck, Paul |
|
#2
|
||||
|
||||
|
Re: button Switch
Our team uses Labview. That's where the issue is because there isn't a "toogle" vi there
|
|
#3
|
||||
|
||||
|
Re: button Switch
Our team has hit a snag here, too. We're trying to run a Victor whenever we push a button, but Labview doesn't seem to have an easy way of doing this, unfortunately.
|
|
#4
|
||||
|
||||
|
Re: button Switch
I don't know how to use LabView (to me it's a waste of time) and I'm not involved with the programming on my team. However, you can still create a variable in labview (make it a boolean, an integer, a double, who cares). And then make it TRUE or 1 when you press the button and flip it each successive press. And then assign the motor value based on that.
-Paul |
|
#5
|
|||
|
|||
|
Re: button Switch
To remember something from one time you process joystick data to the next you need to use either a shift register, a feedback node, a local variable, or a global variable. Any of these will work. Then you do to that storage what the code above showed. You sometimes flip it, and use its value to affect the motor speed.
Greg McKaskle |
|
#6
|
||||
|
||||
|
Re: button Switch
I'm not sure exactly what to use but I think it would involve shift registers or select vi's
|
|
#7
|
||||
|
||||
|
Re: button Switch
I made a primitive toggle switch. But it will only activate/deactivate at a precise time. Probably like every millisecond or something. This is a picture of what we have. The only issue is the starting and stopping at the right time.
|
|
#8
|
|||
|
|||
|
Re: button Switch
You would use shift registers.
Create a false constant outside of your loop, and feed it to the shift register initializer, then have your joystick button feed the case indicator of a case structure. in the true case, put an inverter (NOT gate, on the Boolean tab), in the line, in the false case, just run it straight through. now feed that to the shift register output. tee the motor on/off into that wire now. I hope that made sense, I'd make a simple vi and show you, but i dont have LabVIEW on this pc. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| using a switch/button to turn on a motor | smcmahon | NI LabVIEW | 3 | 26-01-2009 18:42 |
| Push Button and Switch Suppliers for OI controls | Goldberg204 | Control System | 8 | 11-01-2007 15:27 |
| push-button switch on robot | Conan | Electrical | 4 | 10-02-2006 22:03 |
| Need Help Wiring Micro Switch/Limiting Switch | Windward | Electrical | 2 | 07-02-2006 18:26 |
| Button making | Alex Burman | Team Organization | 7 | 10-10-2005 21:45 |