Multiple Buttons With a Single Pin
by dev.alessiobigini in Circuits > Arduino
7454 Views, 164 Favorites, 0 Comments
Multiple Buttons With a Single Pin
![11042161_729356647162291_231646418_n.jpg](/proxy/?url=https://content.instructables.com/F9O/51UQ/I6QD4G57/F9O51UQI6QD4G57.jpg&filename=11042161_729356647162291_231646418_n.jpg)
Hello everyone!
A lot of us happen to end the PIN analog on our board, to avoid this you can create a circuit that depending on the voltage varies Arduino decide which button was pressed.
The Circuit
![Cattura-di-schermata-14.png](/proxy/?url=https://content.instructables.com/FM0/P7EV/I6QD4G72/FM0P7EVI6QD4G72.png&filename=Cattura-di-schermata-14.png)
First we need to:
- Arduino Uno
- A resistor 4.7 KOhm
- Three resistors 1 Kohm
- Four buttons
- Breadboard
- Wires for links
Mounted the circuit as described in the picture or ".fzz" file.
Downloads
The Sketch
![Cattura-di-schermata-13.png](/proxy/?url=https://content.instructables.com/FVU/I9E6/I6QD4G67/FVUI9E6I6QD4G67.png&filename=Cattura-di-schermata-13.png)
After mounting the circuit we go to the sketch:
Code:
// Created by //
// Alessio Bigini 2015 //
// http://alessiobigini.it //
void setup()
{
Serial.begin(9600); //Valore seriale
}
void loop()
{
int sensorValue = analogRead(A0); //Lettura Analogica
float voltage = sensorValue * (5.0 / 1023.0); //Conversione in Volt
Serial.println(voltage); //Stampo nel monitor seriale la tensione
}
Copied and uploaded the sketch on our board, opening the serial monitor, we can see the different voltage values depending on the button pressed.
Downloads
Some Pictures of the Project
![11023165_729356677162288_574699871_n.jpg](/proxy/?url=https://content.instructables.com/F8U/4WGG/I6QD4G3R/F8U4WGGI6QD4G3R.jpg&filename=11023165_729356677162288_574699871_n.jpg)
![11040671_729356657162290_871425079_n (1).jpg](/proxy/?url=https://content.instructables.com/F0R/9R2D/I6QD4G4G/F0R9R2DI6QD4G4G.jpg&filename=11040671_729356657162290_871425079_n (1).jpg)
![10816066_729356667162289_555893716_n.jpg](/proxy/?url=https://content.instructables.com/FGK/YVMI/I6QD4G3D/FGKYVMII6QD4G3D.jpg&filename=10816066_729356667162289_555893716_n.jpg)
For more info visit: