how to display status led and read switch on one pin

Greetings all,

i do not know if its possible, but i have the following problem to solve.

i have a switchboard from a railway station and it controls switches and signals.( it are all cubes with all their own function.)

i have one cube witch controls a switch point and gives back the status of what position the switch is now in.

the cube has 3 connections, one connection is connected to GND, one to the left magnet coil en one to the right magnet coil of the switch point. ( see attachment for schematic )

in the cube the push switches are parallel over the lights ( shorting te light bulb )

is it possible to read the switches and also set back the status led, not having to modify the cubes?

i'm curious if someone has a solution for my problem, or else i have to modify all my cubes.

Greetings Adriaan

A digital pin can be an input (a switch is connected to it) or it can be an output (an LED is connected to it) at any given time. The Arduino can not read the switch AND control the LED at one time.