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
Most probably in the void loop()
part of your .ino
file, since we’d usually want to actively monitor the value.
Click here to learn more on the DIOs of the 9880 board.
This function requires the use of the following CrcLib functions at some point of your .ino
file in order to work properly:
Returns
This function returns 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 unsigned char Crc::CrcLib::GetDigitalInput(unsigned char pin)
The following parameters must be passed to the function for it to work properly:
pin
: The name of the digital pin you want to read the state of. Must be of the typeunsigned char
.
Overloads
This function does not have any overloads. It can only be used as described by the main prototype.
Examples
More on this function
Why does this function return HIGH
/ LOW
, instead of true
/ false
?
The Arduino environment, when speaking of voltage, uses the constant HIGH
to represent its presence and LOW
to represent its absence. In electronics, a voltage presence (or when is is greater than a certain value) is usually represented by true
, while an absence of voltage (or when it is lower than a certain value) is usually represented by false
.
Related articles
-
CrcDuino Hardware Details (Système CrcDuino System) —
This page details the different physical components found on the CrcDuino. Although quite dense in information, it’s a must read!
All voltage values given on this page are using a
GND
pin as reference. AllGND
pins are connected to one another, so using any of them in all situation is acceptable.Page table of content
-
CrcLib: How to access IO pins (Système CrcDuino System) —
This page presents how to access the CrcDuino IO pins using CrcLib.
Pins
-
Debugging - CrcLib Error Codes (Système CrcDuino System) —
What is it?
CrcLib is equipped with a functionality that helps troubleshooting common programming mistakes that cannot be recognize by the compiler before loading the code into the micro-controller.
As your program is executed by the CrcDuino, CrcLib actively monitors the code execution and falls into Error mode if a CrcLib component is incorrectly used.
-
GetDigitalInput() (Système CrcDuino System) —
Purpose
Get the value of a Digital Input (DI) of the board.
When to use
-
SetDigitalOutput() (Système CrcDuino System) —
Purpose
Sets a Digital Output (DIO) Pin to a desired value.
When to use
-
SetDigitalPinMode() (Système CrcDuino System) —
Purpose
Enables the use of a Digital Input/Output (DIO) Pin by telling the program if it should be considered as an Input or an Output.
When to use
0 Comments