SetDigitalOutput()
Purpose
Sets a Digital Output (DIO) Pin to a desired value.
When to use
Every time you want the state of a DO to be modified.
Where to use
Most probably in the void loop()
part of your .ino
file. Can also be used at the beginning of your code execution, in the void setup()
part of your .ino
file, so that the pin is in a known state on startup.
Click here to learn more on the DIOs of the 9880 board.
This function requires the use of the following functions at some point of your .ino
file in order to work properly:
Returns
This function does not return a value once it has completed its tasks.
Main prototype and parameters
static void CrcLib::SetDigitalOutput(unsigned char pin, unsigned char value)
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
. Must have been initialized as an output usingCrcLib::SetDigitalPinMode()
beforehand.value
: The value you want to set the pin to. Must be of the typeunsigned char
. Needs to be one of the following:LOW
, to output 0V on the given DO pin.HIGH,
to output 5V on the given DO pin.
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 not use the native Arduino function digitalWrite() instead of CrcLib::SetDigitalOutput() ?
We recommend using CrcLib::SetDigitalOutput() because it adds a few layers of validation to make sure you don't assign a value to an unsafe pin.