View Single Post
  #5   Spotlight this post!  
Unread 27-01-2005, 12:25
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Relay Assignments

Code:
relay5_rev  =  p3_sw_aux1;
relay5_rev  =  p4_sw_aux1;
The first assignment sets the value based on the switch on port 3. The second assignment then sets the value based on the switch on port 4, regardless of what the first assignment did. p3_sw_aux1 is completely irrelevant to the final result.

You need to set the value based on a combination of the two switches. The | "or" operator will return a value of zero if both its operands are zero, and a value of one if either or both are one.
Code:
relay5_rev = p3_sw_aux1 | p4_sw_aux1;