Help with Digital Input

Hi all,

I am very new to using the Arduino platform and have a (hopefully) quick question about how to implement what I am trying to do - thought I would ask quickly before I blow a board trying...

I want to set a digital input (either Low and set High or Pulled up and then set low). I also want to illuminate an LED when I do this and do not want to use another pin for the LED.

I am thinking I can use the following:

DigIn

If I set pin A0 as INPUT, will this setup light the LED and be seen as HIGH on the input without blowing anything up? (Note: 5V and GND are the same as powering the Nano)

Any help would be appreciated.
Thanks

Please rephrase exactly what the end result will do for you.

:thinking:

Hi, all I am trying to do is set the input high, so that it is readable as high whilst lighting an led at the same time (when the switch is closed)

Connect a 1k resistor from the LED anode to GND.

  • A0 set to input.
  • Switch open, LED is OFF, A0 reads LOW.
  • Switch closed, LED is ON, A0 reads HIGH.

Thanks - is that not what I already have in the diagram?

Connect a 2nd 1k resistor from the LED anode to GND.

OK - like this?

DigIn2

:+1:

1 Like

Thank you very much

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.