An analog keypad. Will it work?
someone asking solution sensing 48 buttons. thought since might need solution similar problem, mocked diagram uses 1 analog pin, 8 digital pins, , 7 resistors. work?
the digital pins pulled gnd active column , left in tri-state non-active columns.
thanks.
the digital pins pulled gnd active column , left in tri-state non-active columns.
thanks.
yes, must scan allong pins see row has pressed button.
something (not tested)
something (not tested)
code: [select]
int keypress()
{
int x;
int row = -1;
int key;
for (int i=0; i< 8; i++)
{
digitalwrite(pin[i], high);
x= analogread(a0);
digitalwrite(pin[i], low);
if (x < threshold)
{
row = i;
break;
}
}
if (row > -1)
{
return 8*row + lookup(x); // ;)
}
return -1;
}
Arduino Forum > Development > Other Hardware Development > An analog keypad. Will it work?
arduino
Comments
Post a Comment