Relay Status Reversed


 

Helloo
Im curently build OCS. I use 4 channel relay to control power for mount, actuator, DSLR and raspberry pi. But for some reason the on/off status of the devices is showing up in reverse in web server (On when off and off when on). Any suggestions on how to correct the problem? 

Thanks


Howard Dutton
 

What constitutes an ON or OFF state depends on the circuit design.

The OCS can, however, adapt both inputs and outputs to swap that logic.
In the OCS.ino file find the following code and change HIGH to LOW as required...

typedef struct {
  uint8_t pin;
  uint8_t onState;
} relay_t;
const volatile relay_t relay[] {
  { 0, HIGH},  // not used
  {23, HIGH},  // Relay 1: pin#, ON state
  {25, HIGH},  // Relay 2: pin#, ON state
  {27, HIGH},  // Relay 3: pin#, ON state
  {29, HIGH},  // Relay 4: pin#, ON state
  {31, HIGH},  // Relay 5: pin#, ON state
  {33, HIGH},  // Relay 6: pin#, ON state
// solid state relays (PWM is enabled on these)
  {35, HIGH},  // Relay 7: pin#, ON state
  {37, HIGH},  // Relay 8: pin#, ON state
  {39, HIGH},  // Relay 9: pin#, ON state
  {41, HIGH},  // Relay 10: pin#, ON state
  {43, HIGH},  // Relay 11: pin#, ON state
  {45, HIGH},  // Relay 12: pin#, ON state
  {47, HIGH},  // Relay 13: pin#, ON state
  {49, HIGH}   // Relay 14: pin#, ON state
};


 

Thank its work