The recommended way is to connect buttons like showed here -
You can omit resistors and Vcc connection and use internal pull-ups instead. But original solution is more reliable.
The recommended way is to connect buttons like showed here -
You can omit resistors and Vcc connection and use internal pull-ups instead. But original solution is more reliable.