Sharing Switch and LED on one pin.
tonyp12
Posts: 1,951
The button is not pressed very often and if the light comes on by itself when button is pressed is OK.
If just using the single 230ohm (led) resistor and no 10k pull-up/down for the switch is a bonus point.
If in very short intervals turning the pin to a input to read the switch and that will turn off the LED is OK.
But if holding down switch will not turn off or on the LED is extra bonus points.
If just using the single 230ohm (led) resistor and no 10k pull-up/down for the switch is a bonus point.
If in very short intervals turning the pin to a input to read the switch and that will turn off the LED is OK.
But if holding down switch will not turn off or on the LED is extra bonus points.
Comments
This circuit will pull the I/O pin to a logic low, but won't draw enough current to light the LED. If the pin is pulled low by software, it will light the LED. Pressing the button will turn it into a pull-up, but the LED will still be lit by pulling it down.