View Single Post
  #13   Spotlight this post!  
Unread 04-03-2011, 23:00
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,572
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: WPI Lib Relay class - individual line control

Quote:
Originally Posted by de_ View Post
The class description seems to hint that we need to declare 2 relays on the SAME channel,
- one with forward only (line 1) control
Relay m_relay1(1, Relay::KForwardOnly);
- and one with reverse only (line 2).
Relay m_relay2(1, RElay::kReverseOnly);

And then we can control each line relay individually.
This will cause an exception because relay 1 will be allocated twice.

Quote:
Originally Posted by de_ View Post
Or do you declare a single relay and change the direction to access a specific line on the fly like

Relay m_relay(1);

:
m_relay.SetDirection(Relay::kForwardOnly); // access 1 line of the spike
m_relay.Set(Relay::kOn) ; // set On or Off 1st line
m_relay.SetDirection(Relay::kReverseOnly); // access 2nd line
m_relay.Set(Relay::kOn); // set On or Off 2nd line....
:

Sorry last coding I did was on an RC
With this code, whenever the relay is set to ForwardOnly, the reverse will be off, and vice versa.
Reply With Quote