-->
Page 1 of 2

Why PIN never goes LOW?

PostPosted: Wed Jul 29, 2020 4:41 am
by Numian
Hello,
I have this simple code:

Code: Select allvoid action() {
  digitalWrite(2, HIGH);
  delay(2000);
  digitalWrite(2, LOW);
  }

void setup() {
  pinMode(2, OUTPUT);
  action();
}

void loop() {
}


Why PIN never goes LOW? I am measuring continuity between D4 and GND.

Thank you.

Re: Why PIN never goes LOW?

PostPosted: Wed Jul 29, 2020 1:14 pm
by Numian
If I put that function into loop(), PIN is 'blinking' HIGH-LOW over and over again, but i need it to do only one during setup. What did I wrong?

Thanks again.

Re: Why PIN never goes LOW?

PostPosted: Wed Jul 29, 2020 2:02 pm
by icons
because its in your loop, instead put it in setup

Re: Why PIN never goes LOW?

PostPosted: Wed Jul 29, 2020 4:09 pm
by Numian
icons wrote:because its in your loop, instead put it in setup

I did. See my first post. Problem is, pin stays HIGH and doesn't go LOW after 2 seconds, as it should. I have no idea why.