Open Music Labs has put up a great tutorial on how to read a matrix of switches, useful if you’re doing a project with keypads or musical keyboards. They cover and provide examples of 12(!) different methods, as well as presenting a spreadsheet which will help you optimize cost and complexity for your particular application. Awesome!
Input Matrix Scanning