Go to Post ...and then at the end they interviewed this 5 year old on his favorite part (of the fair): "I liked the robot" - Jessica Boucher [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-08-2009, 12:23 PM
team877's Avatar
team877 team877 is offline
Registered User
FRC #0877 (Cub Robotics)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2001
Location: North Dakota
Posts: 52
team877 is an unknown quantity at this point
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
Attached Thumbnails
Click image for larger version

Name:	Robot relay.JPG
Views:	189
Size:	41.5 KB
ID:	7362  
Reply With Quote
  #2   Spotlight this post!  
Unread 02-08-2009, 12:56 PM
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #3   Spotlight this post!  
Unread 02-08-2009, 01:03 PM
team877's Avatar
team877 team877 is offline
Registered User
FRC #0877 (Cub Robotics)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2001
Location: North Dakota
Posts: 52
team877 is an unknown quantity at this point
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 02-08-2009, 01:06 PM
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #5   Spotlight this post!  
Unread 02-08-2009, 01:12 PM
team877's Avatar
team877 team877 is offline
Registered User
FRC #0877 (Cub Robotics)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2001
Location: North Dakota
Posts: 52
team877 is an unknown quantity at this point
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.
Reply With Quote
  #6   Spotlight this post!  
Unread 02-08-2009, 01:30 PM
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
  #7   Spotlight this post!  
Unread 02-08-2009, 01:47 PM
paulcd2000's Avatar
paulcd2000 paulcd2000 is offline
Accidentally speaks in C
AKA: Paul Dagnelie
FRC #1719 (The Umbrella Corp.)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Baltimore
Posts: 368
paulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the rough
Send a message via AIM to paulcd2000
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.
Attached Thumbnails
Click image for larger version

Name:	relay 2 button.JPG
Views:	120
Size:	6.0 KB
ID:	7365  
__________________
"People don't say 'It's just a game' when their team is winning!" -- Scott Adams

5.5 students (on average)* $7/h *210 hours/student= $8085 of labor, all volunteered (not counting mentors', who are each that much)

We have blades on our robot?! ***sweeeeeet***

There are 11 types of people in the world. Those who can read binary, those who can't, and those who say this joke is supposed to be, "There are 10 types of people in the world. Those who can read binary and those who have a life."

Last edited by paulcd2000 : 02-08-2009 at 01:54 PM. Reason: Re-examined first image
Reply With Quote
  #8   Spotlight this post!  
Unread 02-08-2009, 02:20 PM
team877's Avatar
team877 team877 is offline
Registered User
FRC #0877 (Cub Robotics)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2001
Location: North Dakota
Posts: 52
team877 is an unknown quantity at this point
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?
Reply With Quote
  #9   Spotlight this post!  
Unread 02-08-2009, 02:26 PM
paulcd2000's Avatar
paulcd2000 paulcd2000 is offline
Accidentally speaks in C
AKA: Paul Dagnelie
FRC #1719 (The Umbrella Corp.)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Baltimore
Posts: 368
paulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the rough
Send a message via AIM to paulcd2000
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.
__________________
"People don't say 'It's just a game' when their team is winning!" -- Scott Adams

5.5 students (on average)* $7/h *210 hours/student= $8085 of labor, all volunteered (not counting mentors', who are each that much)

We have blades on our robot?! ***sweeeeeet***

There are 11 types of people in the world. Those who can read binary, those who can't, and those who say this joke is supposed to be, "There are 10 types of people in the world. Those who can read binary and those who have a life."
Reply With Quote
  #10   Spotlight this post!  
Unread 02-08-2009, 02:43 PM
team877's Avatar
team877 team877 is offline
Registered User
FRC #0877 (Cub Robotics)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2001
Location: North Dakota
Posts: 52
team877 is an unknown quantity at this point
Re: Programming 2 buttons for a relay

But how do i set it between, forward, off, and reverse, or will it do that automatically
Reply With Quote
  #11   Spotlight this post!  
Unread 02-08-2009, 02:55 PM
paulcd2000's Avatar
paulcd2000 paulcd2000 is offline
Accidentally speaks in C
AKA: Paul Dagnelie
FRC #1719 (The Umbrella Corp.)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Baltimore
Posts: 368
paulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the roughpaulcd2000 is a jewel in the rough
Send a message via AIM to paulcd2000
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.
__________________
"People don't say 'It's just a game' when their team is winning!" -- Scott Adams

5.5 students (on average)* $7/h *210 hours/student= $8085 of labor, all volunteered (not counting mentors', who are each that much)

We have blades on our robot?! ***sweeeeeet***

There are 11 types of people in the world. Those who can read binary, those who can't, and those who say this joke is supposed to be, "There are 10 types of people in the world. Those who can read binary and those who have a life."
Reply With Quote
  #12   Spotlight this post!  
Unread 02-08-2009, 03:05 PM
starsROBOTICS starsROBOTICS is offline
Registered User
FRC #2276 (S.T.A.R.S)
Team Role: Engineer
 
Join Date: Mar 2008
Rookie Year: 2006
Location: texas, houston
Posts: 44
starsROBOTICS is on a distinguished road
Re: Programming 2 buttons for a relay

Hey i am also trying to do the same thing. I think that there is a bug in labview. I Opened up two joysticks and wired 2 buttons to their own select function. On the first select function, the true statement was forward and the false statement was 0, i wried that to the false statement of the second select function. On the second select function's true statement was reverse. It was wired to a relay set and wen i ran the program both of the leds light up when i push the button but the relay will only go in one direction. I did the same code for a motor and it worked just fine so i think that the relay vi. has a bug in it
__________________
Reply With Quote
  #13   Spotlight this post!  
Unread 02-08-2009, 03:14 PM
BLAQmx's Avatar
BLAQmx BLAQmx is offline
Software Engineer
no team (National Instruments)
Team Role: Engineer
 
Join Date: Sep 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 100
BLAQmx is a glorious beacon of lightBLAQmx is a glorious beacon of lightBLAQmx is a glorious beacon of lightBLAQmx is a glorious beacon of lightBLAQmx is a glorious beacon of lightBLAQmx is a glorious beacon of light
Re: Programming 2 buttons for a relay

We've worked a couple of examples demonstrating programming joystick buttons for different robot functions.

Joystick Button Control (Using a Functional Global Variable)
__________________
NI FIRST Community: Where to go for LabVIEW, Wind River, cRIO-FRC, and NXT support.
Reply With Quote
  #14   Spotlight this post!  
Unread 02-08-2009, 03:32 PM
windell747 windell747 is offline
Registered User
FRC #2477
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2001
Location: Hawaii
Posts: 158
windell747 will become famous soon enoughwindell747 will become famous soon enough
Re: Programming 2 buttons for a relay

Hi, Here is some code that avoids using case statements since it seemed overkill. We ran into the problem in which the red light would appear to be blinking at a fast rate and flickering. We resolved this issue by ensuring that a relay command is given only once during each execution. We did this by using select blocks. The true and false signals are enum constants in which I just copied from the relay set vi (right click on the input for the relay set vi and create as constant then make multiple copies of that to put as inputs to the select blocks). For our code, we set one button for forward and another for reverse. When either both or none of the buttons are pressed, the relay defaults to the off state. We are actually controlling two relays with the same control signals so you will see two relay set vis, just ignore the second one. I attached a picture.

This was a little too much but for forward and reverse we created boolean equations that are represented by the logical ands and ors that you see in the code.

I really hope this helps! If you have further questions feel free to ask!
Attached Thumbnails
Click image for larger version

Name:	button example.JPG
Views:	106
Size:	34.2 KB
ID:	7367  
Reply With Quote
  #15   Spotlight this post!  
Unread 02-17-2011, 10:09 PM
LatinDrummaBoy LatinDrummaBoy is offline
Registered User
FRC #3518
Team Role: Student
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Lecanto FL
Posts: 3
LatinDrummaBoy is an unknown quantity at this point
Question Re: Programming 2 buttons for a relay

Hello, Im having some issues with something similar to this. I have 2 relays connected to window motors that are controling the arm movement. They are already inverse from eachother so i dont have to invert it on the code. What im having trouble with is im using the Y-axis on the joystick to control it, and when i push it forward, it works, but if i pull it back, it wont go back. i really need help with this. i keep looking over the code and it seems logical, i guess is some minor detail. I would Post a pictrue of the code but im not able to at the moment. This would help me so much if i could get an example. Team 3518 will greatly apreciate the service.
__________________
Team 3518
Jose G.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming a relay in C++ Kage C/C++ 2 01-10-2009 05:51 PM
Programming a single relay to two buttons in easyC Pro? Gizmo2417 Programming 1 02-17-2008 05:10 PM
Help Programming Buttons LordFrz Programming 3 02-14-2008 01:55 PM
Easy C Relay Programming Team_486 Programming 1 03-26-2007 03:01 PM
Relay Programming Questions... comwiz7 Programming 11 02-21-2006 01:04 PM


All times are GMT -5. The time now is 11:34 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi