What's if I link NC but it's turn on when HIGH and turn off when LOW

I link the stuff like here

and it doesn't work like it should: it turn off when HIGH and turns on when LOW

then I change to link my stuff with NC,
it still doesn't work as it turns off when LOW and turns on when HIGH

void setup()
{
pinMode(8, OUTPUT);
}

void loop(){
digitalWrite(8, HIGH);
}

I would like to understand why it's working this way, as I need to link a heating wich should be turn on most of the time except some time

thanks in advance everybody

On -high, off -low or On -low, off -high are the only two possibilities with a relay. What else were you expecting it to do?

Choose the one you prefer and just work with it.

Steve

tanepal:
and it doesn't work like it should: it turn off when HIGH and turns on when LOW

You have omitted to give us the Web link for what relay module you are using - the article you cite shows that there are many different ones. :roll_eyes:

What you describe is exactly the correct operation for many - perhaps most - of the commonly available modules, described as "low level trigger".

You need to write the pin HIGH in setup() before you set it to OUTPUT with pinMode in order to prevent it flicking on as your code starts.

Then you simply write it LOW when you want your relay to switch on, and HIGH to switch it off. Perfectly easy! :grinning:

yes fully sorry I use this one

the 8 one. As I need to put some other stuff later.

Paul__B:
Then you simply write it LOW when you want your relay to switch on, and HIGH to switch it off. Perfectly easy! :grinning:

Ok I thought that when link on NC it's should turn off when HIGH.

Link corrected: https://www.amazon.fr/gp/product/B07CT7SLYQ/ref=as_li_qf_asin_il_tl

Yes, this is indeed a "low level trigger" board which you program as I explained. Here is the circuit per relay:

If you connect the load to the NC link, the load will be ON when the relay is NOT energized and OFF when the relay IS energized.

:slight_smile: ok so normally when I use LOW it should be ON ? because it doesn't :'D

HIGH in setup()

Paul__B:
You need to write the pin HIGH in setup() before you set it to OUTPUT with pinMode in order to prevent it flicking on as your code starts.

Then you simply write it LOW when you want your relay to switch on, and HIGH to switch it off. Perfectly easy! :grinning:

I don't realy get that, is that what you want me to code ?

void setup() {
pinMode(8, HIGH);
pinMode(8,OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(8,LOW);
}

Maybe a little basic electronics is in order.
As already pointed out, the opto-coupler makes the relay input ACTIVE LOW, which is why Paul_B
suggested you write a High BEFORE configuring it as an output which will make the INITIAL STATE OFF.
What part of LOW = ON did you not understand ?

raschemmel:
Maybe a little basic electronics is in order.
As already pointed out, the opto-coupler makes the relay input ACTIVE LOW, which is why Paul_B
suggested you write a High BEFORE configuring it as an output which will make the INITIAL STATE OFF.
What part of LOW = ON did you not understand ?

Are u upset with me ?
you want to help on that conversation ?
U could maybe tell me if what I wrotte is OK, like that ?

void setup() {
pinMode(8, HIGH);
pinMode(8,OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(8,LOW);
}

Or if you want to be usefull, send me a good reference of what you consider to be the basic knowledge in electronics, as you look to have many of them, wich one did you start with, at the realy begining of your learning ? idealy try to find one in french ; )

Sorry, that's wright I don't get everything quickly, but teaching is most of the time repeat and reapeat and repeat and... Also, english and "C" are not my mother tong ; )
arduino is not my job, my job is to grow plants in a lab :'D
it looks easy to overwhelm people with knowledge, So let's talk a little bit about microbiology and phytovirus DNA invitro reproduction, want you ? ; )

all the best to you.