Thread: Relay code
View Single Post
  #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