Purpose
Get the value of a Digital Input (DI) of the board.
When to use
Whenever you need to use the state of a DI.
Where to use
At the beginning of your code execution, Most probably in the void setuploop()
part of your .ino
file, so that the pin mode is set before the pin is referred to by your codesince we’d usually want to actively monitor the value.
Info |
---|
Click here to learn more on the DIOs of the 9880 board. |
Note |
---|
This function requires the use of the following CrcLib functions at some point of your |
Returns
This function does not return a value once it has completed its tasksreturns state of the DI mentioned as the function’s argument as an unsigned char
type. The value returned will be either one of these two possible values:
HIGH
, if voltage is applied to theSIG
pin of the digital port.LOW
, if no voltage is applied to theSIG
pin of the digital port.
Main prototype and parameters
static void Crc::unsigned char CrcLib::SetDigitalPinModeGetDigitalInput(unsigned char pin, unsigned char mode)
The following parameters must be passed to the function for it to work properly:
pin
: The name of the digital pin you want to set. Must be of the typeunsigned char
.mode
: The mode you want to set the pin to. read the state of. Must be of the typeunsigned char
. Needs to be one of the following:INPUT
, if you are using the digital pin as as input.OUTPUT
, if you are using the digital pin as as output.
Overloads
This function does not have any overloads. It can only be used as described by the main prototype.
Examples
Expand | ||
---|---|---|
| ||
Info | ||
Are there any other mode than Click here to learn more about the different pin modes on an Arduino board. Note that a pull-up resistor is connected to all digital pins of the 9880 board, so using |
Code Block |
---|
More on this function
Info |
---|
Why not use the native Arduino function pinMode() instead of CrcLib::SetDigitalPinMode() ?We recommend using CrcLib::SetDigitalPinMode() because it adds a few layers of validation to make sure you don't assign a mode to an unsafe pin. |
|
More on this function
Info |
---|
Why does this function return |
Related articles
Filter by label (Content by label) | ||||||
---|---|---|---|---|---|---|
|