Using switch inputs for Arduino -shared with CMOS Logic?

Good afternoon,

I'm a newbie and have been working on a hobby project to control a model railroad turntable using a stepper motor. So far things have gone well but I've now run into an issue which I can't seem to resolve.

I have 13 buttons (simple push to make momentary switches) on my panel which are encoded by means of a diode matrix into a 4-bit value. I feed these lines into the Arduino inputs 8 - 11 and use port manipulation to create a Byte variable which reflects the button pressed. With a test lash-up this works fine and I've developed and refined the sketch so it does what I want.

Now I'm building it out - I want to use the switch output to also fire a CMOS D-Type flip-flop (CD4013) so that an LED lights while the turntable is in motion. The switch output is taken to the 'S' pin on the chip and the 'Q' output switches on a transistor that lights the LED.

I've also added a rather crude de-bounce circuit which uses a 1K resistor charging a 1uF capacitor to create a 1mS delay. However, when I take the output from this through the diode matrix to the Arduino, it doesn't raise the I/P line. If I disconnect the Arduino, I can observe the diode matrix O/P going high when I press the button (using a logic probe). If I connect the Arduino, it's as if the arduino is 'sitting on' the voltage and it doesn't go high - so the sketch never reads the input.

Can anyone explain why this is and what I need to do please to get this to work correctly? Do I need a 1k resistor in series with the Arduino feed? Should I remove the 10k pull-downs on the inputs and use the internal ones instead? Anyother useful suggestions will be welcome.

I've attached circuit diagrams of both working and non-working versions.

Thank you very much

Seems like a complicated way to get there.
Why not wire the 13 buttons into a 4x4 keypad, use the keypad.h library to read which one is pressed?
Then use a regular output pin to drive the LED vs adding another chip?

Hmm - What can I say? I had a load of diodes and strip-board and soldering is easy!

Actually - the 4013s, switches & LEDs were all part of the original controller which used a 6v motor called via a relay with photo-electric sensors under the turntable. It worked but accuracy was poor - depending on load. Hence the need to re-develop using a stepper.

What puzzles me is why it works when using a switch - diode - arduino. But when I add the other electronic bits, it doesn't!

BTW - I've tried providing the 5v power to the switch circuits both from an independent PSU (with connected logic ground of course!) and using the 5v feed form the Arduino. Both have the same result.