12-16-2020 10:56 AM
Hello!
How do I change this code, so that if state one is true, then output number 1. Then if state two is true then output 2 in numeric.
Thanks in advance.
Solved! Go to Solution.
12-16-2020 11:09 AM
What if both inputs are TRUE? And what about H3? Maybe a simple truth table would help narrow down exactly what you are trying to do.
12-16-2020 11:27 AM
Given three switches, there can be a total of eight possible states. You only have 6 LEDs.
Please clarify the problem and provide a full truth table as requested.
Also note that you probably could dramatically simplify your code by using arrays as controls and indicators.
12-16-2020 11:37 AM
@altenbach wrote:
Given three switches, there can be a total of eight possible states. You only have 6 LEDs.
Please clarify the problem and provide a full truth table as requested.
Also note that you probably could dramatically simplify your code by using arrays as controls and indicators.
One possible interpretation...
12-16-2020 11:47 AM
Okay, maybe I expressed myself wrong. It is true that there are 8 possible states, but they are not intresting in what im trying to do. The thing i want to do is output a number instead of a led light. So the led in the top "tillstånd 1" should output 1 in a numeric number.
12-16-2020 11:59 AM
Wire a numeric indicator to the output of "boolean array to number". Right?
12-16-2020 12:01 PM
If only one LED can be TRUE, do "search array" for true and display the index (-1 if all are off).
Depending on how you want to count, add a +1 if needed.