Go to Post If you look at where you have come from you can often tell where you are going. - Turtlecoach [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-02-2013, 11:41
Connor1868 Connor1868 is offline
Registered User
FRC #4143
 
Join Date: Feb 2012
Location: United States
Posts: 10
Connor1868 is an unknown quantity at this point
How to toggle a relay with one button?

I need to turn a relay on and off your one button on the joystick. Much like a toggle button. Could some one give me some sample code?
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2013, 11:53
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,795
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: How to toggle a relay with one button?

Here's a generic button toggle example:


Put one Relay set in the inside True case, the opposite set in the inside False case.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2013, 11:58
Connor1868 Connor1868 is offline
Registered User
FRC #4143
 
Join Date: Feb 2012
Location: United States
Posts: 10
Connor1868 is an unknown quantity at this point
Re: How to toggle a relay with one button?

What are the green arrows?
Reply With Quote
  #4   Spotlight this post!  
Unread 02-02-2013, 12:09
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,795
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: How to toggle a relay with one button?

The green arrow is found on the Programming -> Structures palette.
It's called a Feedback node, and what it does for you is remember the previous value, so the current value can be compared to the previous value.

So for the button press the value can be thought of as 0 (false) or 1 (true).
That first peculiar little combination is checking to see of the button is going from off (the previous value) to on (the current value), so it's only true the very first time you press the button and won't be true again until the button is release and pressed again.

To change the arrow direction once you put it on your block diagram, right-click and choose Change direction.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 02-02-2013 at 12:14.
Reply With Quote
  #5   Spotlight this post!  
Unread 02-02-2013, 12:19
Connor1868 Connor1868 is offline
Registered User
FRC #4143
 
Join Date: Feb 2012
Location: United States
Posts: 10
Connor1868 is an unknown quantity at this point
Re: How to toggle a relay with one button?

How does the arrow become green? I found the arrow, but it is black.
Reply With Quote
  #6   Spotlight this post!  
Unread 02-02-2013, 12:22
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,795
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: How to toggle a relay with one button?

It changes color based on the data type that then gets wired to it.
It's green in the example because a boolean wire got connected to it.
So it'll turn green when you wire the button output to it.

If you wired an integer to it, then it would turn blue.
A floating point number would make it orange instead.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #7   Spotlight this post!  
Unread 02-02-2013, 12:25
Connor1868 Connor1868 is offline
Registered User
FRC #4143
 
Join Date: Feb 2012
Location: United States
Posts: 10
Connor1868 is an unknown quantity at this point
Re: How to toggle a relay with one button?

Thank you very much! It worked
Reply With Quote
  #8   Spotlight this post!  
Unread 02-02-2013, 12:33
Connor1868 Connor1868 is offline
Registered User
FRC #4143
 
Join Date: Feb 2012
Location: United States
Posts: 10
Connor1868 is an unknown quantity at this point
Re: How to toggle a relay with one button?

What about false in the outer case structure of?
Reply With Quote
  #9   Spotlight this post!  
Unread 02-02-2013, 12:38
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,795
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: How to toggle a relay with one button?

The outer false case avoids doing anything at all.
That's when the button hasn't been pushed again.
The wire just gets passed from the input tunnel right to the output tunnel.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 02-02-2013 at 19:09.
Reply With Quote
  #10   Spotlight this post!  
Unread 02-02-2013, 15:29
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: How to toggle a relay with one button?

One of our veteran team members wrote a very simple and effective Toggle vi, which I've attached. Just feed the button signal into the input, then use the output with a select block or case structure to select your relay state.
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	143
Size:	2.8 KB
ID:	13765  
Attached Files
File Type: vi Toggle.vi (9.4 KB, 52 views)
Reply With Quote
  #11   Spotlight this post!  
Unread 29-06-2013, 16:04
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: How to toggle a relay with one button?

I was asked to provide a screenshot of what our team's Toggle VI looks like, so here's how it works!
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2013-06-29 at 2.57.49 PM.png
Views:	130
Size:	10.2 KB
ID:	15037  
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


All times are GMT -5. The time now is 12:12.

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