// wire grid resistive sensing #define CountLoop 5 // how many times to take a reading #define Threshold 1010 // sensitivity threshold for analog inputs void setup() { Serial.begin(9600); } void loop() { int PinRowVal; int PinColVal; int SelectRow = 0; int SelectCol = 0; int Pressed; // set columns to OUTPUT LOW, set rows to INPUT and enable pullups for (int i=0;i<3;i++) { pinMode(17+i, OUTPUT); digitalWrite(17+i, LOW); pinMode(14+i, INPUT); digitalWrite(14+i, HIGH); } // do an analog read of the row pins; stop when the first one // drops below the threshold for (int RowCount=0;RowCount<3;RowCount++) { PinRowVal = 0; for (int i=0;i 0) && (SelectCol > 0)) { // representing the pressed button in bit notation Pressed = 1 << (SelectCol+(SelectRow-1)*3)-1; Serial.print("Row:"); Serial.print(SelectRow); Serial.print(" Col:"); Serial.print(SelectCol); Serial.print(" Linear:"); Serial.print(Pressed, BIN); Serial.print("\n"); } }