AnsweredAssumed Answered

How To Add Multiple Buttons With Analog Pins for Stm8

Question asked by Stuart Ken on Jul 28, 2017

While I know how to add a single button to a pin (as a digital input) for the stm8s103f3p6.

What I want to know is how to add multiple buttons using resistive analog inputs.

Specifically I wish to know how to add 12 buttons as 4 buttons on three analog pins.

Im stuck on the programming. I know thought that the circuit is a voltage divider

made up of high valued resistors on each of the three pins.

Here is the Arduino version  for it for 1 pin

 

http://tronixstuff.com/2012/02/29/tutorial-analog-input-for-multiple-buttons-part-two/ 

 

so it like above but on three pins not 1.

I searched a while on the internet for the answer but cant find it. In your answer -make the code in C++ and give the precise circuit.

Outcomes