A digital input, used for reading the state of a pin. More...
#include <DigitalIn.h>
Public Member Functions | |
DigitalIn (PinName pin) | |
Create a DigitalIn connected to the specified pin. More... | |
DigitalIn (PinName pin, PinMode mode) | |
Create a DigitalIn connected to the specified pin. More... | |
~DigitalIn () | |
Class destructor, deinitialize the pin. More... | |
int | read () |
Read the input, represented as 0 or 1 (int) More... | |
void | mode (PinMode pull) |
Set the input pin mode. More... | |
int | is_connected () |
Return the output setting, represented as 0 or 1 (int) More... | |
operator int () | |
An operator shorthand for read() More... | |
A digital input, used for reading the state of a pin.
Example:
Definition at line 56 of file DigitalIn.h.
DigitalIn | ( | PinName | pin | ) |
Create a DigitalIn connected to the specified pin.
pin | DigitalIn pin to connect to |
Definition at line 67 of file DigitalIn.h.
DigitalIn | ( | PinName | pin, |
PinMode | mode | ||
) |
Create a DigitalIn connected to the specified pin.
pin | DigitalIn pin to connect to |
mode | the initial mode of the pin |
Definition at line 78 of file DigitalIn.h.
~DigitalIn | ( | ) |
Class destructor, deinitialize the pin.
Definition at line 86 of file DigitalIn.h.
int is_connected | ( | ) |
Return the output setting, represented as 0 or 1 (int)
Definition at line 114 of file DigitalIn.h.
void mode | ( | PinMode | pull | ) |
Set the input pin mode.
pull | PullUp, PullDown, PullNone, OpenDrain |
operator int | ( | ) |
An operator shorthand for read()
Definition at line 128 of file DigitalIn.h.
int read | ( | ) |
Read the input, represented as 0 or 1 (int)
Definition at line 97 of file DigitalIn.h.