Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   How to control relays (http://www.chiefdelphi.com/forums/showthread.php?t=73257)

Parthenon 30-01-2009 16:07

How to control relays
 
I have gotten to a point where I need to control relays, however, I cannot find documentation in the C++/C Programming guide on how to do so. To my understanding, in order to make the relay move the forward, you would have to use relay1.Set(relay1.kForward); I try this, but it doesnt move forward =(

MattD 30-01-2009 16:58

Re: How to control relays
 
You should be able to do it like this:

Code:

relay1.Set(Relay::kForward);
To later turn it off:

Code:

relay1.Set(Relay::kOff);

Alan Anderson 30-01-2009 17:09

Re: How to control relays
 
Quote:

Originally Posted by Parthenon (Post 811144)
relay1.Set(relay1.kForward);

Try
Code:

relay1.Set(Relay::kForward);
instead. The thing before the double colon :: and the kForward constant isn't an object. It's a "namespace", in this case saying you want to use the named constant from the group of things associated with the Relay class.

Maxpower57 31-01-2009 16:23

Re: How to control relays
 
if the relay is a *pointer then you'd use this
Code:

relay1->Set(Relay::kReverse);


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

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