Go to Post you are never an alumni of FIRST, you can always be there, mentoring, learning, creating. - KelliV [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-27-2005, 10:58 AM
MulletFish MulletFish is offline
Registered User
AKA: Eric Fischer
FRC #2827 (Lambda Cubed)
Team Role: Teacher
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Coronado
Posts: 6
MulletFish is an unknown quantity at this point
Relay Assignments

I am trying to assign more than one joystick button to a single relay_rev. I have tried using an "=" sign, I have tried adding a new line but the program recognizes one but not the other. How can I do it? Thanks!
  #2   Spotlight this post!  
Unread 01-27-2005, 11:02 AM
Max Lobovsky's Avatar
Max Lobovsky Max Lobovsky is offline
Fold em oval!
FRC #1257 (Parallel Universe)
Team Role: College Student
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Scotch Plains, NJ
Posts: 1,026
Max Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant future
Send a message via AIM to Max Lobovsky
Re: Relay Assignments

The default code includes some code that controls some of the relays, make sure you check if that is overriding some of your stuff.
__________________
Learn, edit, inspire: The FIRSTwiki.
Team 1257


2005 NYC Regional - 2nd seed, Xerox Creativity Award, Autodesk Visualization Award
2005 Chesapeake Regional - Engineering Inspiration Award
2004 Chesapeake Regional - Rookie Inspiration award
2004 NJ Regional - Team Spirit Award
  #3   Spotlight this post!  
Unread 01-27-2005, 11:17 AM
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 7,800
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Send a message via AIM to Alan Anderson
Re: Relay Assignments

Quote:
Originally Posted by MulletFish
I am trying to assign more than one joystick button to a single relay_rev. I have tried using an "=" sign, I have tried adding a new line but the program recognizes one but not the other. How can I do it? Thanks!
Use C's | "or" operator.

Code:
relay3_rev = p1_sw_trig | p2_sw_trig;
  #4   Spotlight this post!  
Unread 01-27-2005, 11:18 AM
MulletFish MulletFish is offline
Registered User
AKA: Eric Fischer
FRC #2827 (Lambda Cubed)
Team Role: Teacher
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Coronado
Posts: 6
MulletFish is an unknown quantity at this point
Re: Relay Assignments

Here is the code I have:

relay5_rev = p3_sw_aux1;
relay5_rev = p4_sw_aux1;

There are no other references to the relay in the "Buttons to Relays" section. It seems to me that it should work???
  #5   Spotlight this post!  
Unread 01-27-2005, 11:24 AM
Max Lobovsky's Avatar
Max Lobovsky Max Lobovsky is offline
Fold em oval!
FRC #1257 (Parallel Universe)
Team Role: College Student
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Scotch Plains, NJ
Posts: 1,026
Max Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant future
Send a message via AIM to Max Lobovsky
Re: Relay Assignments

Ah, I misunderstood what you are trying to do (thought you meant multiple relays to one button, not vice versa). Alan Anderson has it right. Use the "or" operator just as he suggested.
__________________
Learn, edit, inspire: The FIRSTwiki.
Team 1257


2005 NYC Regional - 2nd seed, Xerox Creativity Award, Autodesk Visualization Award
2005 Chesapeake Regional - Engineering Inspiration Award
2004 Chesapeake Regional - Rookie Inspiration award
2004 NJ Regional - Team Spirit Award
  #6   Spotlight this post!  
Unread 01-27-2005, 11:25 AM
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 7,800
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Send a message via AIM to Alan Anderson
Re: Relay Assignments

Code:
relay5_rev  =  p3_sw_aux1;
relay5_rev  =  p4_sw_aux1;
The first assignment sets the value based on the switch on port 3. The second assignment then sets the value based on the switch on port 4, regardless of what the first assignment did. p3_sw_aux1 is completely irrelevant to the final result.

You need to set the value based on a combination of the two switches. The | "or" operator will return a value of zero if both its operands are zero, and a value of one if either or both are one.
Code:
relay5_rev = p3_sw_aux1 | p4_sw_aux1;
  #7   Spotlight this post!  
Unread 01-27-2005, 11:52 AM
MulletFish MulletFish is offline
Registered User
AKA: Eric Fischer
FRC #2827 (Lambda Cubed)
Team Role: Teacher
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Coronado
Posts: 6
MulletFish is an unknown quantity at this point
Re: Relay Assignments

Quote:
Originally Posted by Alan Anderson
Use C's | "or" operator.

Code:
relay3_rev = p1_sw_trig | p2_sw_trig;
Thanks Alabn. I tried that and it still does not work.
  #8   Spotlight this post!  
Unread 01-27-2005, 12:14 PM
Max Lobovsky's Avatar
Max Lobovsky Max Lobovsky is offline
Fold em oval!
FRC #1257 (Parallel Universe)
Team Role: College Student
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Scotch Plains, NJ
Posts: 1,026
Max Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant future
Send a message via AIM to Max Lobovsky
Re: Relay Assignments

Use some printf's or other diagnostic and determine if the trigger that isn't working is actually changing the variable.
__________________
Learn, edit, inspire: The FIRSTwiki.
Team 1257


2005 NYC Regional - 2nd seed, Xerox Creativity Award, Autodesk Visualization Award
2005 Chesapeake Regional - Engineering Inspiration Award
2004 Chesapeake Regional - Rookie Inspiration award
2004 NJ Regional - Team Spirit Award
  #9   Spotlight this post!  
Unread 01-27-2005, 12:32 PM
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 7,800
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Send a message via AIM to Alan Anderson
Re: Relay Assignments

Quote:
Originally Posted by MulletFish
...it still does not work.
You'll have to give more details than that if you want useful help. What are you expecting to happen? How are you testing to see if it happens? What happens instead of what you expect?

Specifically, what do you have connected to the Spike, and what else is it connected to?
  #10   Spotlight this post!  
Unread 01-27-2005, 01:15 PM
MulletFish MulletFish is offline
Registered User
AKA: Eric Fischer
FRC #2827 (Lambda Cubed)
Team Role: Teacher
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Coronado
Posts: 6
MulletFish is an unknown quantity at this point
Re: Relay Assignments

It works! You guys are awesome! Thanks so much!
Closed Thread


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
Spike (relay) module pin out coreyjon Electrical 14 04-05-2004 06:05 AM
Relay Aliases Backwards Jeff Zampieron Programming 19 02-18-2004 03:27 PM
Wiring the relay for the pnumatics Placebo OCCRA 3 11-05-2002 10:04 PM
Division assignments now available in Team 340 database archiver 2001 13 06-24-2002 02:05 AM
Relay Outputs OddOne Technical Discussion 3 02-01-2002 06:52 PM


All times are GMT -5. The time now is 07:56 PM.

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


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