728x90
[Digital I/O]
Description
Configures the specified pin to behave either as an input or an output. See the Digital Pins page for details on the functionality of the pins.
As of Arduino 1.0.1, it is possible to enable the internal pullup resistors with the mode INPUT_PULLUP. Additionally, the INPUT mode explicitly disables the internal pullups.
Syntax
pinMode(pin, mode)
Parameters
pin: the Arduino pin number to set the mode of.
mode: INPUT, OUTPUT, or INPUT_PULLUP. See the Digital Pins page for a more complete description of the functionality.
Returns
Nothing
Example Code
void setup() {
pinMode(13, OUTPUT); // sets the digital pin 13 as output
}
void loop() {
digitalWrite(13, HIGH); // sets the digital pin 13 on
delay(1000); // waits for a second
digitalWrite(13, LOW); // sets the digital pin 13 off
delay(1000); // waits for a second
}
Notes and Warnings
The analog input pins can be used as digital pins, referred to as A0, A1, etc.
See also
-
EXAMPLE Description of the digital pins
'홍익인간 프로젝트 > Arduino C' 카테고리의 다른 글
[아두이노 레퍼런스] Serial.write() 함수 (0) | 2021.01.31 |
---|---|
pulseIn() Function (0) | 2021.01.22 |
What's means F() function ? (0) | 2021.01.14 |
u8g2setupcpp (0) | 2020.12.25 |
PCF8574 I2C 확장보드로 CLCD, Text(텍스트) LCD 구동 (아두이노) (0) | 2020.12.25 |