I recently received a dozen of those SMD momentary push buttons https://www.aliexpress.com/item/UXCELL-10-Pcs-3-Pin-5-Way-Momentary-Push-Button-Smd-Smt-Mini-Tactile-Switch/32808035008.html
I bought those with up/down/action buttons replacement in mind, and with hope it could also replace rotary buttons in some of my projects.
By using a 100k, 10k and 1k resistors, I managed to make it use only two analog pins on the nano, thus freeing my breadboard from three wires compared to using a rotary encoder.
An accidental benefit is that it's so thin it can easily be glued to the back side of an 128x32 OLED screen (other models don't fit well). This gives a very handy feel to the build without requiring a specific bezel/case.
Compared to a rotary, it's smaller, saves pins, costs less; I wonder why we don't see more of this on Arduino projects, maybe it break too easily ? I guess I'll find out :-)
Hardware Used:
- Arduino Nano
- SSD1306 (128x32)
- 3 Way Momentary Push Button SMD
- 100K, 10k, 1K resistors
Sofrtare Used:
- Arduino IDE 1.6.7
- U8G2lib (+implemented hardware scrolling)
- Source Code https://gist.github.com/tobozo/14e6b8e605d500caa9dfbfb1548c71a1