If you would like some more examples:
Here's an example of the Arduino code for scanning a pedal board wired in a 4x8 matrix.
https://sites.google.com/site/casavanto ... simple-vpo
And if you don't want to bother with a matrix, here's the code for parallel scanning a 61 note keyboard.
https://sites.google.com/site/casavanto ... el-scanner
Apologies for the double spacing: Google's fault.