I have the problem that on my Arduino Mega 2560 PINs 18-21 are always high, with these values 18(3V), 19(5V), 20(3V), 21(3V).
I wanted to use them as interrupt PINs either connected to 5V or with an 10k pulldown resistor to ground, but even with the pulldown the voltage doesn't really drop (just from 3.11 V to 3.09 V).
Is this meant to be like that, so that I have to pull them down straight to Ground without resistor?
I know a similar behavior only when using
pinMode(SOME_PIN, INPUT_PULLUP);
Using this also doesn't bring them to 5V but they stay around 3V (except PIN 19 which is always 5 V)
No there is Nothing connected and my total sketch is:
void setup() {
}
void loop() {
}
So nothing as well. I found the only way of using those PINs properly is pulling them down as much as you can (with as little impedance as possible), if possible to directly ground. Its weird because PIN 2 and 3 work completely different, except if you use INPUT_PULLUP.
If you have an empty sketch and nothing connected you can measure anything (between -0,5V and 5,5V). But you say they are still >1V is you connect a 1k resistor between the pin and GND? If so, it sound like your last project damaged the chip (probably draw to much current or phantom supplied it via those pins).
Pin 14-19 (TX/RX pins) should be 0volt with a blank sketch loaded.
Pin 20 and 21 (I2C) should be ~5volt, because of the onboard 10k pull up resistors.
Confirmed with my own Mega.
If you're measuring different values, then I'm affraid those pins are damaged.
3volt is weird. How are you powering the Mega.
You shouldn't use those pins for anything else than TX/RX and I2C.
Leo..