View Full Version : How to control relays
Parthenon
30-01-2009, 16:07
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 =(
You should be able to do it like this:
relay1.Set(Relay::kForward);
To later turn it off:
relay1.Set(Relay::kOff);
Alan Anderson
30-01-2009, 17:09
relay1.Set(relay1.kForward);
Try 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
if the relay is a *pointer then you'd use this
relay1->Set(Relay::kReverse);
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.