Hi, i used an old dartboard matrix on an Arduino Uno.
Now if i touch on the dartboard it shows the reading in de Serial monitor like 2,3 or 5,1 or...
Can i change something in the code, so i can read the real number like on the dartsboard like 20, 19, double 4 etc.... Do i use if or map the whole thing...?
My code for now;
int masterLines = 8;
int slaveLines = 8;
int matrixMaster[] = {13, 12, 11, 10, 9, 8, 7, 6};
int matrixSlave[] = {5, 4, 3, 2, A5, A4, A3, A2};
void setup() {
Serial.begin(9600);
Serial.println("Mijn Darts");
for(int i = 0; i < slaveLines; i++){
pinMode(matrixSlave[i], INPUT_PULLUP);
}
for(int i = 0; i < masterLines; i++){
pinMode(matrixMaster[i], OUTPUT);
digitalWrite(matrixMaster[i], HIGH);
}
}
void loop() {
for(int i = 0; i < masterLines; i++){
digitalWrite(matrixMaster[i], LOW);
for(int j = 0; j < slaveLines; j++){
if(digitalRead(matrixSlave[j]) == LOW){
Serial.print(j);
Serial.print(",");
Serial.println(i);
delay(500);
break;
}
}
digitalWrite(matrixMaster[i], HIGH); } }