I have an Arduino Opta with two digital expansion boards. I am able to use digitalWrite to set the relays closed or open. However, on a wifi connection made with the board, I want to be able to get the status' of all of the relays but I read the entirety of the docs and have found no way to read this. Does anyone know how?
I have no experience of the board but can't you just set the value of a variable to indicate the status of the relay, perhaps true if on and false if off, then read the value of that variable ?
omg, this is so obvious. On my previous system, I had an RTU and a PC where the PC might restart but the RTU relays could still stay open/closed. Now that I am using a single unit, i can just keep track..... thank you so much. one of those situations where I missed the forest for the trees
Sometimes it is neccesary to directly read the digital outputs. E.g. if you use the OPTA in a PLC application, a parallel task could modify the outputs and you need access to the outputs states inside the sketch.
In addition to the .digitalRead(digital_input_pin) function the 'Arduino_Opta_Blueprint' library includes the .digitalOutRead(relay_output_pin) function and the constant OPTA_DIGITAL_OUT_NUM for the number of outputs available.
Example:
#include "OptaBlue.h"
...
DigitalMechExpansion mechExp = OptaController.getExpansion(0);
if(mechExp) {
for(int k = 0; k < OPTA_DIGITAL_OUT_NUM; k++) {
/* this will return the pin status of the pin k */
PinStatus v = mechExp.digitalOutRead(k);
if(v == HIGH) {
Serial.print("HH");
}
else {
Serial.print("LL");
}
Serial.print(' ');
}
Serial.println();
}
...