Matrix keypad with pins 0 and 1

I've got a project I'm building using an older Arduino Uno. Every pin is used so I can't just switch around to solve my problem.

I have a 4x4 matrix keypad connected. The row assignments are working fine. The columns are not, though.

I'm using pins 0,1,2,6 for the columns. I get proper values from the pin 2 and pin 6 columns but the 0 and 1 columns are not working at all. I've confirmed continuity end to end and have switched from my own sketch to a barebones matrix keypad sketch. If I switch from {0,1,2,6} to {6,2,1,0} I get the same failure of pins 1 and 0.

I understand that pins 0 and 1 are different in that they are serial port pins. Is there some special way to handle these pins for the keypad?

Thanks!

Is there some special way to handle these pins for the keypad?

No, just don't use them.

Have you used all/any of the analogue pins in your project ?

Yep - the only pin not used is 10 because I need it for hardware SPI.

Are you saying there's no modification I can make to get this to work?

Oh I just had an epiphany.

It's my troubleshooting that's causing the problem. I used Serial.print to see if the keypad is working right. But by doing so I caused it to fail. As soon as I used the Serial.begin(9600); it turned pins 0 and 1 into Tx/Rx and they no longer worked for digital i/o.

Sheesh.

Thanks for your time - looks like I have to find a better way to troubleshoot!

I am glad that the penny has dropped.

As a matter of interest what are you using the pins for ?

Are all of the analogue pins used for analogue input or are some digital ?

Are any of the pins used for switch/button inputs ? I ask because it is possible to differentiate between multiple different switch inputs using just one analogue input

I'm building this https://pulsar124.fandom.com/wiki/Hardware_h1.3

It's a focus stacking rail for macro photography. It uses 8 pins for the keypad, 4 pins for a Nokia 5110 display, a pin for shutter release, 3 pins for a big easy motor driver, a pin for limiting switches, and a pin for autofocus. All told that's 18 pins on an Uno that has 14 digital and 6 analog. It leaves me with pin 10 and I think one analog free.

Thanks!

Which of those requires analogue pins ?

Could you manage with a 3 by 4 keypad to save another pin ?

I could probably switch things around but there's no need. I was just verifying that it worked right by using the SerialPrint function. As it turns out that caused me problems that weren't there lol.

mark