2025-07-24 11:19:26
Tonny12138
The normal way to take pull-up pin as input is to use:
pinMode(pin, INPUT)
The way above is accpectable because the pull-up selection register on the 8-bit AVR chip is the same as the output selection register. But you can't do this again for M0! You need to use:
pinMode(pin, INPUT_PULLUP)
The code written in this way still has the advantage of backward compatibility with AVR. You do not need a separate version for different board types.
