−So here is the dilemma. You ran out of digital input pins but you still need to add seven buttons. Fortunately there is a way you can add all these digital inputs as long as you have an analog pin. What you need to do is wire all the buttons and connect it to a R-2R Ladder. A R-2R Ladder is a very simple Digital to Analog converter. You treat your buttons as if they were bits and you use an analog pin on a microcontroller to read them.
+So here is the dilemma. You are running out of digital input pins but you still need to add six buttons. Fortunately there is a way you can add all these digital inputs as long as you have an analog pin. What you need to do is wire all the buttons and connect it to a R-2R Ladder. A R-2R Ladder is a very simple Digital to Analog converter. You treat your buttons as if they were bits and you use an analog pin on a microcontroller to read them.
In practice the accuracy of an R-2R ladder becomes more poor as more bits are added. Most hobbiest do not go over 5 bits since the required tolerance of the resistors need to be less than 1% beyond that.
In practice the accuracy of an R-2R ladder becomes more poor as more bits are added. Most hobbiest do not go over 5 bits since the required tolerance of the resistors need to be less than 1% beyond that.
−
If you mapped these buttons to act as bits in R2 ladder the following would be true.
If you mapped these buttons to act as bits in R2 ladder the following would be true.
Exception encountered, of type "Error"