Pinball Project

I found a potential solution. In my desperation, I thought that maybe the little transience when wires connected pin11 goes from high to low could effect the wires connected to pin12. So, as much as you all discourage delays, I added a one ms delay between writing to pin11 and reading pin12. And yes, it seems like it made the trick. At least in this very stripped off test.

  digitalWrite(11, HIGH);
  delay(1);  
  if(digitalRead(12) == LOW)  
  {
    digitalWrite(13, LOW);
  } 
  else
  {
    digitalWrite(13, HIGH);
  }

This time, the LED only flashes when the switch is closed, just as I excpected.

Well, that's all for tonight. Tomorrow I hopefully will get the time to test this scanning the whole switch matrix.

EDIT: The downside of this solution (if it even works) is that it adds 6 milliseconds to every complete switch matrix scan performed.