so i saw a video of Massimo Banzi demonstrating a 4 key button piano and i want to convert it to 25 keys using only one input wire like he did. so id like to know if anyone has the code or if someone can lead me in the right direction. ive been wanting to make this for quite awhile know so any help would be apreciated.Link to the video: - YouTube
Do the same he did but with 25 buttons.
Like this How to Access 5 Buttons Through 1 Arduino Input : 8 Steps - Instructables
there you have to put different resistor values on each button, so each one gives a different voltage drop.
You can also make it like a single bus of resistors like the old keyboards on the analog days, all resistors same value, but when first button is pressed, only first resistor is counted, when 2nd button two resistors, 3rd button 3 resistors, etc.
Btw, 25 buttons may be too much for only one input, what I mean: 1024 / 25 = 40. So each button is 40 values away from the others. 40 is not much, the input itself has some fluctuations of +/- 2 or so. If the temperature of the resistor changes they'll have a different resistance, and it may not work properly. You could use two analog inputs so you use 12 on one input and 13 on the other, it'll be safer
Use some shift-in registers instead.
Sample them 100 times a second or similar, act to make a note(s) when you see a change.
digitalWrite(LOAD, LOW); // replace with direct port manipulation for even faster digitalWrite (LOAD, HIGH); // parallel load of inputs bank0 = SPI.transfer(0); bank1 = SPI.transfer(0); bank2 = SPI.transfer(0); bank3 = SPI.transfer(0); // analyze the inputs
Better still, get one decade counter for less than a dollar and a cheap kids keyboard and build one of these -