Hi,
First, I am new: to electrical engineering (even the basics), arduino, and these forums. But I'm a competent programmer of many languages and platforms, so the learning curve here is mostly with the electrical components.
I have an UNO, a 20x4 LCD display, and a 4x4 matrix keypad. I have run several sketches successfully and have the LCD working having soldered the header pins myself! Woot!
The keypad has stumped me. First I tried what came intuitively: assuming everything is OFF and expecting a row and column ON when a key is pressed. So I connected the pins, set them to INPUT, and wrote their values to Serial every few milliseconds. Not only did I get nowhere when pressing keys, but there seemed to be erratic values being read, especially if I came even close to touching the keypad, its backing, or the ribbon cable attached to its 8-pin connector.
I also tried INPUT_PULLUP to no avail. The output was less erratic, but I was definitely not getting keypress readings.
A few moments ago, I found this post here:
http://forum.arduino.cc/index.php?topic=146106.msg2046909#msg2046909
... and it helped a ton. I reviewed the last poster's code and I understand what is being done. Instead of copying the code, I wrote it myself to achieve the same objective. HEY IT WORKS!!
But I don't understand why. Why do the rows (or columns) have to be set as OUTPUT, set HIGH, and then toggled LOW one at a time before checking the columns (or rows) for a corresponding LOW?
Any explanation is appreciated!
-Phillip