Without declaring the pin 2 as INPUT or OUTPUT, it remains constantly HIGH. Can anyone explain why is it so?


1 Answer 1


Pin 2 connects to the controller's PE4, which is a GPIO pin, which can also be used for PWM. You should be able to use it either as input or output, and both high and low. It could be that setup initializes it as output high, while you would usually have uninitialized pins as input.

enter image description here

Have you tried to make it low, or make it input?

digitalWrite(2, LOW);   

should make it low, while

pinMode(2, INPUT);
int pin2Status = digitalRead(2);
digitalWrite(13, pin2Status);   

will copy the status of pin 2 to the on-board LED.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.