Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Relay code (http://www.chiefdelphi.com/forums/showthread.php?t=101730)

kingkurry 01-02-2012 18:23

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?

BurtGummer 01-02-2012 21:26

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?


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

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