Introduction: Multiple Buttons With a Single Pin

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.

Step 1: The Circuit

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.

Step 2: The Sketch

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.

Step 3: Some Pictures of the Project

For more info visit:

http://alessiobigini.it/