Relay Module State
-
Hello everyone,
Is it possible to read the relay state? (on/off | open/closed).
I could be less lazy and write my code so I have a file that shows the last state but reading the state would be far better imo.Thank you.
-
@None-None it is definitely possible, after all the Relay Expansion is controlled through I2C.
If you want to work it out for yourself, you can take a look at the i2c-exp-driver repo on GitHub. Start with https://github.com/OnionIoT/i2c-exp-driver/blob/master/src/relay-exp.c
You'll see that it uses functions from:
https://github.com/OnionIoT/i2c-exp-driver/blob/master/src/lib/onion-mcp23008-driver.cYou'll be able to see the register responsible for controlling the state of the relays.
If you don't wanna work it out for yourself... lemme know and I'll tell you