Without declaring the pin 2 as INPUT or OUTPUT, it remains constantly HIGH. Can anyone explain why is it so?
1 Answer
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.
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.