If you want to build a button array, follow this diagram. The main idea here is to connect each button to a diode in a row by column fashion, and read all the rows column by column. Rows works as ...
Follow Black or White Line. gives you two strategies for sensing , digital or analog. Controlling the wheels' speed from 0% to 100%.