FAQ

Pin Output and Pull-up

userHead Tonny12138 2024-07-24 11:18:37 68 Views1 Replies

Pin Output and Pull-up

2025-07-24 11:19:26

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.

userHeadPic Tonny12138