digitalWrite HIGH-LOW ERROR

Hi, i have a problem with digitalWrite HIGH-LOW commands. My problem is basicly LOW and HIGH commands work opposite.
For example:

digitalWrite(relay1, LOW);
Make relay active and if i use high command, it deactives.

Hi @peregrin3
Everything is a matter of reference.
In order to explain it better, post a schematic of your project.
It can even be done freehand.

RV mineirin

#define can be used the make things more understandable.

#define relayON        LOW
#define relayOFF       HIGH
. . .
digitalWrite(relay1, relayOFF);
digitalWrite(relay1, relayON);

The relay probably has an opto-isolator on the input. The anode of the LED in the opto-isolator is tied to 5V and the cathode will go to the digital output. So it takes a LOW on the Arduino's digital output to light the LED and actuate the relay.

Thanks for answers, I dont mind using low command instead of high, the thing i wonder is if it suddenly start working normal so my project will be a mess, but if its sourced by relays then it will be okay i guess

The current paths shown a bit differently:

It can't change the way that it works without rewiring the relay module.

@peregrin3, your topic has been moved to a more suitable location on the forum.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.