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
Once for each DIO Pin used on the board. If you connect anything to a digital pin, its mode should be set.
Where to use
At the beginning of your code execution, in the void setup()
part of your .ino
file, so that the pin mode is set before the pin is referred to by your code.
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 Crc::CrcLib::SetDigitalPinMode(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. 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
More on this function
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.
Are there any other mode than INPUT
and OUTPUT
?
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 INPUT
has the same effect as using INPUT_PULLUP
. Google is a great place to learn about pull-up resistors (and its sister, the pull-down resistor), but this page is a good introduction.
Articles liés
-
CrcDuino: détails matériels (Système CrcDuino System) —
Cette page présente les différentes composantes physiques qui se retrouve sur une carte électronique CrcDuino. C’est une lecture assez chargée, mais elle en vaut la peine!
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. -
CrcLib: accéder aux broches IO (Système CrcDuino System) —
Cette page présente les constantes symboliques définies dans CrcLib en utilisant la directive du pré-processeur
#define
.Broches
-
Déverminage - Codes d'erreur CrcLib (Système CrcDuino System) —
Cette page présente les codes associés au mode d’erreur de CrcLib.
What is it?
-
GetDigitalInput() {FR} (Système CrcDuino System) —
Objectif
Obtenir l'état d’une entrée digitale (DIO) sur le CRCduino.
Quand l’utiliser
-
SetDigitalOutput() {FR} (Système CrcDuino System) —
Objectif
Contrôle une broche digitale (DIG) en mode sortie
Quand l’utiliser
-
SetDigitalPinMode() {FR} (Système CrcDuino System) —
Objectif
Permets d’utiliser les entrées sorties digitales (DIO) en indiquant à la librairie si cette broche doit être une entrée ou une sortie.
Quand l’utiliser?
Add Comment