Datasheet

Flyport Wi-Fi and Ethernet Programmer's guide framework 2.3 (rev 1.0) www.openpicus.com
In the pull-down circuit of the figure, we can see that when the switch is opened (no other sources
are connected), the input pin “reads” a low voltage value. If we close the switch (and connect a high
voltage source), we change the what the pin “reads” to a high value.
In the pull-up case, we have a high value when the switch is open, and a low value when the switch is
closed, because the internal reference is high and the external reference is low.
The convenience of using the internal pull-up/pull-down resistors is that they are inside the
microcontroller, and you can change them without adding external components.
NOTE: Pay attention of the different pull-up/pull-down values on switch states!
QUESTION: How can we catch a pushbutton state change? Pressed or Released?
Buttons need always internal pull-up (“inup”) or pull-down (“indown”) resistors enabled.
Input type Button pressed Button released
inup ON to OFF OFF to ON
indown OFF to ON ON to OFF
Check the state of a pushbutton IOButtonState(pin name)
Returns: pressed if the button has been pressed
released if the button has been not pressed or released
You don't have to keep track of the state of the pin, or of its logical value. The openPicus framework
does this work for you and tells you if the button has been pressed or released.
13