S
S
syxoi2018-03-23 19:11:59
Arduino
syxoi, 2018-03-23 19:11:59

Arduino why pin is not responding to low with serial enabled?

Hello,
I am writing this sketch for Arduino Uno:

void setup () {
  pinMode(0,OUTPUT);
  digitalWrite(0,LOW);
}

void loop () {
delay(1000);
}

Everything works fine: the relay turns on (I have a relay with reverse logic, i.e. turns on at low and turns off at high).
But if you turn on the serial port, then the controller completely stops responding to low and always keeps it high (about 4.8 V on the pin):
void setup () {
  Serial.begin(9600);
  pinMode(0,OUTPUT);
  digitalWrite(0,LOW);
}

void loop () {
delay(1000);
}

Why is that? I've already broken my brain, I can not understand what the problem is ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Syomov, 2018-03-23
@syxoi

You have pin 0.1 when you turn on the UART, this module controls it, respectively, they are no longer controlled as GPIO. In particular, PIN0 You
may need to move your relay to a different pin. Or don't initialize the UART...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question