Pin 5 in INPUT_PULLUP mode isn't pulled HIGH
-
- Posts: 8
- Joined: 31 Oct 2017 07:21
Pin 5 in INPUT_PULLUP mode isn't pulled HIGH
I'm trying to use pins 5,6,7,8 with the builtin pullup resistor and I discovered that pin 5 is still floating despite the mode being INPUT_PULLUP. Is this a known limitation? I checked all the other pins and they were all working properly. It just seems like pin 5 it doesn't work on. I've tried on the two z-unos that I have.
Re: Pin 5 in INPUT_PULLUP mode isn't pulled HIGH
This was fixed recently and will become part of next release. This is because of UART/USB. After they are initialized, change it again to pull-up and it should work then
-
- Posts: 8
- Joined: 31 Oct 2017 07:21
Re: Pin 5 in INPUT_PULLUP mode isn't pulled HIGH
Is there a workaround for the current release? I tried having pinMode after Serial.begin() but it still had the same issue.
Re: Pin 5 in INPUT_PULLUP mode isn't pulled HIGH
The workaround is to initialize it after the first loop(in the second loop).
For example try this:
For example try this:
Code: Select all
byte loop_cnt = 0;
void loop()
{
if(loop_cnt < 2)
{
if(loop_cnt == 1)
{
// ...
pinMode(5, INPUT_PULLUP);
// ...
}
loop_cnt++;
}
}
Re: Pin 5 in INPUT_PULLUP mode isn't pulled HIGH
This problem is not only at pin 5. I had the same problem at pin 18. But the workaround works
Re: Pin 5 in INPUT_PULLUP mode isn't pulled HIGH
It is on all pins sharing the same port (8 pins)