|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Programming 2 buttons for a relay
Hi, I'm trying to get button one on my controller to make the relay go forward, and button 2 on my controller to make it go in reverse. I have a picture of what i have so far and if anyone else can remake this picture and put in the changes it needs to make this works that would be great!
Thank you |
|
#2
|
|||
|
|||
|
Re: Programming 2 buttons for a relay
Keep in mind that the way you wrote it, the optional code is producing the constant, but you are still calling the relay function regardless of what the buttons do. In fact you are calling it twice. Try putting the subVI inside of the case statement too. That way if button one, you send the one value to the relay. In parallel, if button two, send the other command to the relay. If neither button, don't do anything to the relay.
Greg McKaskle |
|
#3
|
||||
|
||||
|
Re: Programming 2 buttons for a relay
Is it possible for you to put this into labview, and send it over as a picture. I'm an 18 year old with about 0 experience on LABVIEW and officially don't know what i'm doing.
|
|
#4
|
|||
|
|||
|
Re: Programming 2 buttons for a relay
Not super easy. If you open the diagram that you took a picture of, click on the relay and drag it to the left into the case structure next to it. Then reconnect the pink wire to the upper left. Then do the same to the other relay. Then test.
Greg McKaskle |
|
#5
|
||||
|
||||
|
Re: Programming 2 buttons for a relay
I tried it, and it didn't work. What happens is button 1 will do the reverse command, but button 2 remains unresponsive.
|
|
#6
|
|||
|
|||
|
Re: Programming 2 buttons for a relay
I suspect the code is doing what you told it, just not what you wanted. If you right click, you can set a breakpoint on the relay function inside the case for button two. Then you will know for sure that the button is setting the relay off.
The next question is, what does turning off the relay really do on your robot.?Is that the right thing to do? Changing the constant to other values may be the right thing. Be safe, especially if this is controlling pneumatics. Greg McKaskle |
|
#7
|
||||
|
||||
|
Re: Programming 2 buttons for a relay
Have you tried the diagram detailed in the image?
You would need to change the Reverse to Off, and in the True Case, set the relay to Reverse. Last edited by paulcd2000 : 08-02-2009 at 13:54. Reason: Re-examined first image |
|
#8
|
||||
|
||||
|
Re: Programming 2 buttons for a relay
But, i would need to put the "and" function into both cases? or do i only need one?
|
|
#9
|
||||
|
||||
|
Re: Programming 2 buttons for a relay
well, the "and" block is outside the case structure. so you shouldn't need to put in two of them.
|
|
#10
|
||||
|
||||
|
Re: Programming 2 buttons for a relay
But how do i set it between, forward, off, and reverse, or will it do that automatically
|
|
#11
|
||||
|
||||
|
Re: Programming 2 buttons for a relay
ok, inside the case structure, True will execute when both are pushed, and false will execute if anything else is pushed. inside of that, pick which one you want it to do. just change where it says "reverse" or "off" or whatever.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming a relay in C++ | Kage | C/C++ | 2 | 10-01-2009 17:51 |
| Programming a single relay to two buttons in easyC Pro? | Gizmo2417 | Programming | 1 | 17-02-2008 17:10 |
| Help Programming Buttons | LordFrz | Programming | 3 | 14-02-2008 13:55 |
| Easy C Relay Programming | Team_486 | Programming | 1 | 26-03-2007 15:01 |
| Relay Programming Questions... | comwiz7 | Programming | 11 | 21-02-2006 13:04 |