0

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

asked Nov 30, 2018 at 2:05

1 Answer 1

2

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.

answered Nov 30, 2018 at 3:10
3
  • 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. Commented 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 part Commented Nov 30, 2018 at 13:51
  • Ahh the internal pull ups were not enabled. Thank you very much. Commented Nov 30, 2018 at 14:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.