ruffrecords
Well-known member
I am considering a small micro-controller project that has a number of push buttons and associated LEDs. Rather than use a port pin per per switch and another per LED I wondered if it is possible to combine an LED and switch on each port pin. The LED would be wired from the port pin to the supply via the usual current limit resistor. The push button would go from the port pin to 0V. With the port set as an output the LED can be turned on/off. With it set as an input the switch can be read. The port would normally be set as an output. The switch scan routine would flip the port pin to an input, read the switch condition and return the port pin to an output. This should happen quickly enough not to introduce a notice able flicker in the LED.
Is this common practice? Will it work?
Cheers
Ian
Is this common practice? Will it work?
Cheers
Ian