View Single Post
  #3   Spotlight this post!  
Unread 01-02-2009, 00:20
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,113
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: boolean equations to relay commands

To simply use a boolean result to select between two values of another type, I think a case structure is overkill. Using a "boolean selector" is easier and results in code that can be seen all at the same time. Here's an example of it in use:

Ignore the surrounding loop and associated shift registers, and focus on the boolean input to the selector. When it is true, the top numeric input appears on the output; when it is false, the bottom numeric input appears on the output. This works with relay constants just as well as it does with numbers.