Go to Post Is this where I get to say "Mama I made it on TV?" - Pauline Tasci [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Spotlight this post!  
Unread 18-02-2012, 00:23
NS_Radication's Avatar
NS_Radication NS_Radication is offline
Student
AKA: Marco Schoener
FRC #1369 (Minotaur)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Tampa
Posts: 88
NS_Radication is an unknown quantity at this point
Re: Help Please!(Rookie Team)

Quote:
Originally Posted by Ginto8 View Post
I don't really know the electrical side of things here, but I do know that there's a pretty simple method for using Spike relays: the Relay class.
Basically, you initialize one with the required port and the direction:
Code:
Relay relay = new Relay(PORT,direction); // direction can be Relay.Direction.kFoward,Relay.Direction.kReverse, or Relay.Direction.kBoth
Then you set it to one of four options (but it will throw an InvalidValueException if you set it to a direction it isn't configured for):
Code:
relay.set(Relay.Value.kOff); // 0v-0v, any direction
relay.set(Relay.Value.kForward); // 12v-0v, kForward or kBoth
relay.set(Relay.Value.kReverse); // 0v-12v, kReverse or kBoth
relay.set(Relay.Value.kOn); // 12v-12v, any direction
Correction:

relay.set(Relay.Value.kForward or kReverse)

Should be

relay.setDirection(Relay.Direction.kForward or kReverse, or kBoth);

Hope this helps! Happy Competitions!
__________________
Team 1369
Senior
Head Programmer (Java)
Head Electrician
Reply With Quote
 


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 11:28.

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