Struggling with a shortage of digital pins on your Arduino board? In this video, I've got you covered! Learn how to connect a rotary switch without depleting all your digital pins by employing just one analog pin.
🤔 Why Go Analog?
Traditional methods of connecting rotary switches demand multiple digital input pins, potentially exhausting your Arduino's available resources. Discover a smarter approach that conserves pins while efficiently managing your project's needs.
🔧 Applicable to Various Microcontrollers
This technique isn't exclusive to Arduino; it's compatible with a range of microcontrollers like Raspberry Pi, ESP32, and ESP8266, provided an analog pin is available.
📁 Get the Code
Access the code I used in this demonstration via GitHub: github.com/5cottyD/Projects/t...
🔗 Purchase Links from AliExpress here
ARDUINO UNO R3 CLONE: s.click.aliexpress.com/e/_DDV...
ARDUINO MICRO CLONE: s.click.aliexpress.com/e/_De4...
ROTARY SWITCH VARIOUS POLES: s.click.aliexpress.com/e/_DEE...
⏱️⏱️VIDEO CHAPTERS⏱️⏱️
------------------------------------------------
0:00 Intro
0:07 Digital pin method Wiring diagram
1:30 Analog pin method Wiring diagram
3:06 Resistor value selection
4:17 Breadboard Example
7:18 Arduino analogRead input range from 0 to 1023
8:07 Rotary switch setup / wiring / soldering
9:45 Wiring diagram vs Rotary switch setup
10:00 Coding example for reading input only and Serial monitor output/results
11:30 Readings are never exact and fluctuate
12:04 Coding example for reading input and assigning pin number and Serial monitor output/results
14:04 Adjusting Switch number to analog value
14:33 Rotary switch end product
15:03 Project example with minimum pin usage
📺 Explore more electronics tutorials in this playlist:
• Electronics & Projects
🔔 Subscribe to the channel and hit the notification bell to stay updated with the latest Electronics videos and tutorials!
/ @scottydiy
🔗 Check out Josephine's channel for her content: / @josephine5766
🔖 Tags: #arduino #arduinoproject #rotartyswitch
13 июл 2024