How can I digitalRead a pin that is in pinMode OUTPUT?

后端 未结 11 1085
不知归路
不知归路 2020-12-09 02:30

I have a very simple test sketch in which I\'m trying to set a pin to HIGH and then read its state with digitalRead. Here is my sketch.

<         


        
11条回答
  •  不知归路
    2020-12-09 03:12

    Keep a separate boolean map of the output pin states.

    If a microcontroller GPIO pin is set as an input, then its value, when read, depends on what it's connected to externally. That's kind of the point.

提交回复
热议问题