I am trying to use an ATTINY85/Ardunio Uno to turn an LED on and listen to a button input. I don't mind if the LED turns on when the button is used.
I am have found this thread from a couple of years ago however it doesn't seem to work at low voltage (3V) due ending up with floating pins due to the forward voltage of the LED. I was wondering if anyone had a soltion or if they could check to see if my solution would be suitable.
Many Thanks
schematic
simulate this circuit – Schematic created using CircuitLab
1 Answer 1
I think this is what you want...
schematic
simulate this circuit – Schematic created using CircuitLab
To check for button, set pin to INPUT and enable pullup. If pin is LOW, then the button is pushed.
To light LED, set pin to OUTPUT and LOW.
-
Ah this is the one I tried to link, OP has been updated. The issue I am having with this one is the drop in voltage of the LED is 1.6V so it's causing it to float and go in-between input states.Archie– Archie2018年11月30日 12:04:01 +00:00Commented Nov 30, 2018 at 12:04
-
@Archie why is it "floating in-between input states"? if you enable the pull-up, either the button is not pressed (and so the pin floats to 3.3V, even if the LED is not conducting anymore, since there is a pull-up) or it is pressed (and so it is capable of pulling low both the pull-up and the LED, and it goes to GND). Please note that the LED is put not in the same position as your circuit, but it is in the upper part, while the button is in the low partfrarugi87– frarugi872018年11月30日 13:51:35 +00:00Commented Nov 30, 2018 at 13:51
-
Ahh the internal pull ups were not enabled. Thank you very much.Archie– Archie2018年11月30日 14:56:05 +00:00Commented Nov 30, 2018 at 14:56