Skip to content

module_read_channels

Vladimir edited this page Feb 14, 2020 · 2 revisions

Reading state of all channels

Relay relay = ...

int status = relay.ReadChannels();

The lower 8 bits reflect the status of the corresponding channels. For example, how to get state of channels #1 & #8:

int status = this.ReadChannels();
int channel = 1;
bool state1 = (status & (1 << (channel - 1))) != 0;
channel = 8;
bool state8 = (status & (1 << (channel - 1))) != 0;