Go to Post [I] [/I]I think this may be some kind of record. We got through 9 entire posts before someone mangled the spelling of mecanum. [I] [/I] - Ether [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-02-2012, 18:23
kingkurry kingkurry is offline
Registered User
FRC #4067
 
Join Date: Jan 2012
Location: Maryland
Posts: 20
kingkurry is an unknown quantity at this point
Relay code

How do you program a spike relay? For example what code would i use to get a spike relay to go forward, then stop?
Reply With Quote
  #2   Spotlight this post!  
Unread 01-02-2012, 21:26
BurtGummer BurtGummer is offline
Electrical/Mechanical/Programming
FRC #3020
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Southern CA
Posts: 89
BurtGummer will become famous soon enoughBurtGummer will become famous soon enough
Re: Relay code

Do you want it to go forward for X seconds, or when you press a stop button?

To create it, you'd first make the object in Java.

Code:
Relay myRelay = new Relay(int moduleNumber, int channel);
Now that we created the Relay object, we can tell it what to do. If you want it to go forward, you could do something like this:
Code:
myRelay.set(kForward);
To turn it off, you would instead use:

Code:
myRelay.set(kOff);
Where and how you use those pieces of code is dependent on when or how you want the values to change. Will it be time based? Do you want a button to turn it off, or maybe a sensor instead?
__________________
I'm a mentor looking for a home in Southern California! I know Java, C++, electrical and mechanical.

Need Java or C++ help? Send me a PM!
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 22:20.

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