Reference for Wiring 1.0 (ALPHA) 0017+. If you have a previous version, use the reference included with your software.
If you see any errors or have any comments, let us know.
Name
pinMode()
Examples
int inpin = 0;
int outpin = 1;
int val = 0;
void setup() {
pinMode(inpin, INPUT);
pinMode(outpin, OUTPUT);
}
void loop() {
val = digitalRead(inpin, HIGH);
if(val == HIGH)
{
digitalWrite(outpin, HIGH);
} else {
digitalWrite(outpin, LOW);
}
}
Description
The pinMode() method sets the specified digital I/O pin as INPUT or OUTPUT. A digital or binary I/O pin can have two possible values: HIGH or LOW. Is it possible to set or read the value of a digital I/O pin by using the digitalWrite() and digitalRead() methods.
pinMode() 메소드는 지정한
디지털 I/O 핀이 INUT 또는 OUTPUT
으로 사용된는 것을
지정합니다. 디지털
또는 I/O 핀은 HIGH 와 LOW 두개의
값만 가능합니다. digitalWrite() and digitalRead()
메소드에 의하여
디지털 I/O 값을
설정하거나 읽을 수
있습니다.