Go to Post We should be celebrating every potential new science and technology leader regardless of which number is on his/her t-shirt. - Dmentor [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 08-03-2010, 20:05
dnrobotics11 dnrobotics11 is offline
Registered User
FRC #2589
 
Join Date: Mar 2008
Location: Massachusetts
Posts: 55
dnrobotics11 is an unknown quantity at this point
Relay Code

Hi everyone,

I have a quick question about the C++ code for spike relays. What are the two arguments in the phrase "relay(x, y)" when I am initializing the relay in the code? One of them is clearly the relay port but what is the other and what is the order of them? Thanks a lot.
Reply With Quote
  #2   Spotlight this post!  
Unread 08-03-2010, 20:45
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: Relay Code

you only need one if you are using slot 4 (default)
if you are not in slot 4, the first is the slot (if it is not 4, it's probably 6), the second is the relay port (on the DSC)
if you have it in 4, use relay(relayPort)
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Reply With Quote
  #3   Spotlight this post!  
Unread 08-03-2010, 21:31
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Relay Code

There are two possible constructors for the Relay class (from relay.h). Here are their definitions:
Code:
Relay(UINT32 channel, Direction direction = kBothDirections);
Relay(UINT32 slot, UINT32 channel, Direction direction = kBothDirections);
You can find the header files in c:\windriver\vxworks-6.3\target\h\wpilib.
__________________

Last edited by mikets : 08-03-2010 at 22:39.
Reply With Quote
  #4   Spotlight this post!  
Unread 08-03-2010, 23:03
dnrobotics11 dnrobotics11 is offline
Registered User
FRC #2589
 
Join Date: Mar 2008
Location: Massachusetts
Posts: 55
dnrobotics11 is an unknown quantity at this point
Re: Relay Code

thanks so much guys
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
spike relay code urgent chris janney Java 1 21-02-2010 17:55
Relay Robopanda6 Java 5 07-02-2010 01:08
Spike relay code not working wywern209 Programming 9 05-02-2010 22:04
C++ Relay Code? Happyisgood C/C++ 10 16-07-2009 14:54
Intermittent CODE ERROR, followed by uncommanded relay switching tcj103 Programming 4 22-01-2007 02:59


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

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