Mega2560

Hello,

I have bought the brand new Arduino Mega 2560 rev3 because I was very happy about my other Arduino Mega 2560 rev1 board .
However this one seems to be slower : if I plug the 5V pin to a digital input pin, the board is able to see this (=> digitalRead(pin)=1). But if I disconnect the 5V pin, the board continues to read “1” during several seconds, before to read “0”.
Would you know why and how to fix it?
My program works very well with my old Arduino Mega. So it’s not a program issue.
All help is welcome!! :slight_smile:
Thanks a lot in advance

Would you know why and how to fix it?

It's a floating input.
What you describe is perfectly normal.
If you don't want it to float, tie it high or low.

Thanks a lot for your quick answer. I'm reading about your answer "Floating input" because I never heard about this !
How can I tie it high or low with DigitalRead?
Thank you :slight_smile:

You haven’t describe how, or to what, the pin is connected, but a simple way is to use the built-in pullups, described here

Thanks a lot!!
It works now very well!
I'm reading your document : very interesting! Have a nice day