Setting pin HIGH then LOW

Just a quick question. Having set an INPUT HIGH, by momentarily applying 5v, it seems that the pin stays HIGH.

Should digitalWrite(pin, LOW) be used to set the pin LOW in this case, or is there another way of doing it?


If you use digitalWrite, then the pin will stay at whatever state you set it to until you change it to the opposite state.

Mike. Thanks for your reply. I have since found a site that addresses newbie questions.

If you meant "momentarily apply 5V" as in "connect briefly" such as through a button or switch, then you need to learn about pull-up and pull-down resistors. When you read an unconnected input, it can answer anything it wants to answer.

Thanks. That makes sense now. All working. Motor stepping forward, reverse and stop.