|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Programming a relay in C++
How do you do it? this is probably too general a question, but we just started using C++ for this build season, and we're pretty inexperienced. So we need to know how to properly initialize it, and just basically how to do it. sorry if that's not a good explanation, or if the subject is too broad.
|
|
#2
|
|||||
|
|||||
|
Re: Programming a relay in C++
In this season's code, you would do the following:
Code:
Relay myRelay([slot],[chanel],kBothDirections); //initialize the relay in slot [slot], channel [channel], and allow it to move both directions myRelay.Set(kForward); //turn the relay on in the forward direction myRelay.Set(kOff); //turn the relay off If this isn't enough detail, just say so. |
|
#3
|
|||
|
|||
|
Re: Programming a relay in C++
Since the enumerated members are in the Relay class, you need
Code:
myRelay.Set(Relay::kForward) Also, since the constuctor defaults to kBothDirections, you don't need to include that parameter. So, to initialize a relay object called "r41" on DSC 4 relay channel 1 using the default mode (kBothDirections) and set it forward you'd use: Code:
Relay r41(4,1); r41.Set(Relay::kForward); |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming a single relay to two buttons in easyC Pro? | Gizmo2417 | Programming | 1 | 02-17-2008 05:10 PM |
| Easy C Relay Programming | Team_486 | Programming | 1 | 03-26-2007 03:01 PM |
| Pneumatics (Spike Relay, Solenoid etc.) Programming | oceansidehs | Programming | 8 | 02-10-2007 01:58 PM |
| Relay Programming Questions... | comwiz7 | Programming | 11 | 02-21-2006 01:04 PM |
| Relay Assignments | MulletFish | Programming | 9 | 01-27-2005 02:15 PM |