Arduino Digital pin not getting High

Hi there,

this afternoon I have faced one interesting problem with my Arduino NANO.
I am using NANO for one of my ongoing project in which I am making one digital pin high on the bases of external input(Switch) but unfortunately randomly digital pin stops getting HIGH until next reset. I don't know what I am missing here which causes it.

Only one LED with a 500-ohm resistor is connected with the digital pin I am making HIGH.

I am using Arduino from last 4 year but never faced this type of problem.

I have also tried different NANO board but still same results.

Any guideline or help will be very helpful!!

vijaylohan:
I don't know what I am missing here which causes it.

I know what I'm missing... That would be your code...

Did you pinMode() the pin as an output?

I don't know what I am missing

Code and a schematic.

You're welcome

Yes, I did but still the same issue!!

vijaylohan:
Yes, I did but still the same issue!!

You have to wait five minutes between posts.

Can I suggest you think hard before you post?

Perhaps secret code keeps the output level secret as well? :-]

Is your input pin set to INPUT or INPUT_PULLUP?

Do NOT use pin 1 (or pin 0) in this way they are already in use. Read the documentation!

Mark