Syntax
void pinMode(
    uint32_t dwPin, 
    uint32_t dwMode
);
ContentsIndex
PreviousUpNext
pinMode
Example
Syntax
void pinMode(
    uint32_t dwPin, 
    uint32_t dwMode
);
Description

Sets up modes for assigned pins. 

There are 16 pins on LinkIt ONE used as digital I/O, they are D0 ~ D13 and D18/D19, particularly D18/D19 are shared with Wire/I2C. 

 

LinkIt One supports 3 pin modes: 

  • INPUT mode is used for reading voltage (HIGH or LOW) or sensor. In INPUT mode when the circuit is at high impedance, similar to serially connecting a big resistance in the circuit, the pin can read accurate voltage value. However, this pin may not have enough voltage to activate peripheral devices, e.g. LED.
  • INPUT_PULLUP mode is similar to INPUT mode, used for reading voltage of sensor. However in this mode, the pin is often at high voltage when the sensor is disabled and turns to low voltage when the sensor is enabled, which is opposite to its behavior in INPUT mode.
  • OUTPUT mode is used for controlling peripheral devices. In OUTPUT mode when the circuit is at low impedance, the pin has enough voltage to activate or control other devices but cannot read the voltage of sensor.
 

Parameters
Parameters 
Description 
uint32_t dwPin 
[IN] Pin number that needs to be set with a mode 
uint32_t dwMode 
[IN] Mode of pin (INPUT, INPUT_PULLUP or OUTPUT) 
Example
#define LED  13
void setup()
{
    pinMode(LED, OUTPUT);
}
void loop()
{
    digitalWrite(LED, HIGH);
    delay(3000);
    digitalWrite(LED, LOW);
    delay(3000);
}
File

wiring_digital.h

Group