04-22-2024 08:05 AM
I am using NI-Switch. I created a simulated module NI2584. The code is working fine. I have 3 indicators that represent the switches. All I want to do is to switch ON and OFF one at a time.
Such that, Switch 1 turns ON, then OFF; Switch 2 turns ON, then OFF; Switch 3 turns ON then OFF; and so on.
Solved! Go to Solution.
04-22-2024 08:11 AM
Hi GRCK,
@GRCK5000 wrote:
All I want to do is to switch ON and OFF one at a time.
Such that, Switch 1 turns ON, then OFF; Switch 2 turns ON, then OFF; Switch 3 turns ON then OFF; and so on.
What doesn't work as expected?
You seem to call the SwitchOn and SwitchOff functions in the correct order...
04-22-2024 08:18 AM
Thanks GerdW for responding. I just don't like the duplication below. Assume, I have to add 100 channels. I don't want to keep repeating the same code over and over.
04-22-2024 08:24 AM
Hi GRCK,
@GRCK5000 wrote:
I just don't like the duplication below. Assume, I have to add 100 channels. I don't want to keep repeating the same code over and over.
The "Channel" input should be an integer value.
And your boolean indicators should be in an array of booleans: then you use the channel number to index an element of the boolean array...