Michael 2727
Senior Member
This is part of the code I used to make a
crude 08M Music keyboard.
<A href='http://porepunkahps.vic.edu.au/home/jef01/files/display/08M-Music-Organ.txt' Target=_Blank>External Web Link</a>
<code><pre><font size=2 face='Courier'>
Using these values you should be able to
make a 12 key Keyboard or 12 Switches/Buttons
on a single ADC input.
crude 08M Music keyboard.
<A href='http://porepunkahps.vic.edu.au/home/jef01/files/display/08M-Music-Organ.txt' Target=_Blank>External Web Link</a>
<code><pre><font size=2 face='Courier'>
Using these values you should be able to
make a 12 key Keyboard or 12 Switches/Buttons
on a single ADC input.
Code:
readadc 4,b0
pause 100 ' Actual ADC measured @ 4.05 Volts.
if b0 >= 0 and b0 <=117then No Change ' is 115 = 120k = Silence.
if b0 >= 118 and b0 <=123 then One ' is 120 = 110k
if b0 >= 124 and b0 <=130 then Two ' is 126 = 100k
if b0 >= 131 and b0 <=136 then Three ' is 133 = 90k
if b0 >= 137 and b0 <=145 then Four ' is 140 = 80k
if b0 >= 146 and b0 <=153 then Five ' is 149 = 70k
if b0 >= 154 and b0 <=164 then Six ' is 158 = 60k
if b0 >= 165 and b0 <=175 then Seven ' is 169 = 50k
if b0 >= 176 and b0 <=189 then Eight ' is 181 = 40k
if b0 >= 190 and b0 <=202 then Nine ' is 195 = 30k
if b0 >= 203 and b0 <=220 then Ten ' is 211 = 20k
if b0 >= 221 and b0 <=240 then Eleven ' is 231 = 10k
if b0 >= 241 and b0 <=255 then Twelve ' is 254 = shorted out Zero Ohms.
' Using a 10K resistor to Neg and the above resistors to the ADC
' input and Pos, the obtained ADC value was made the centre
' value for each "then". ADC value below 115 produces No Change. </font></pre></code>
May come in handy if you are short of input
pins one day,,~ ;o)
An open ended String of 12 equal 10K Ohm resistors were used.
The resistor junctions used to pick each value.
Edited by - Michael 2727 on 25/05/2006 08:29:26