digitalwrite does not work

Hello,

im using something to turn on an LED lamp but it does not work.

this is a bit of code

it passes the Serial.println code but the LED's don't go on.

  {
    Serial.println("LED: AAN");
    digitalWrite(relais_licht, HIGH);
  }

I don't think its a hardware problem since I made a seperate code that makes the LED go on and it works

Why does it not work?

this is a bit of code

Correct.

Where is the rest?

TheMemberFormerlyKnownAsAWOL:
Correct.

Where is the rest?

Here's the full code:
I put it in a pastebin because for some reason it exceeds the 9000 character limit so I can't post my message.
Please forgive me, and thank you for your quick answer!.
https://pastebin.com/2PEAZiuX

rico459:
Why does it not work?

Because there is something wrong in your code. I am 100% certain there is NO problem with digitalWrite().

Missing pinMode for relais_licht

if(relais_licht == HIGH) Not gonna happen

TheMemberFormerlyKnownAsAWOL:
Missing pinMode for relais_licht

if(relais_licht == HIGH)

Not gonna happen

Oh, wow..

How did I not see thath :confused: ??

Thank you so much ive been staring myself blind with this!!

Adopt a logical thought process: Do I really think that digitalWrite doesn't work?
No, because I'd that were true, the forum would be swamped.

So, what would blink a LED, but not operate a relay?
An INPUT alternating between having its pullup enabled and disabled.

What do I/O pins default to?
INPUT.

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