I'm looking for a way to use one or more shift registers to reduce the number of digital I/O pins required for my Keyglove project (http://www.keyglove.net). I have a total of 34 sensors, each of which uses one pin. The controller code tests for conductivity between pairs of pins by looping through each possible pair, setting one to output LOW, and then checking the other's level (the default is HIGH). If the input level is LOW, then the sensors are touching.
I am prototyping with an Arduino Mega board, so I have enough pins without any extra work or hardware. However, the Mega is a very large board. I was looking at possibly using something like the Teensy board (only 1.2 inches in the largest dimension) for the final product. The Teensy++ has 46 I/O pins and would get the job done, but it's larger.
I realize that the size different between a Teensy and a Teensy++ (a whole 0.8" in length) is likely to be no worse than using a separate shift register. However, I'm still curious: is it possible (and easy) to do what I'm proposing?
Any workable solution would need to be able to set and hold one pin in output mode at a specific level while testing a separate pin immediately afterwards. This is why I was looking at shift registers instead of multiplexers. 34 is larger than most people use though (and sadly larger than 32 bits, which might be simpler).
Any ideas? I may just stick with a Teensy++ board and be done with it, but the concept is intriguing to me anyway. I'd love to know how to do it even if there are alternative options.