Index
 
  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  

pulseIn()

   
Examples  
int inpin = 0; 
int val = 0; 
 
void setup() { 
  pinMode(inpin, INPUT); 
} 
 
void loop() { 
  val = pulseIn(inpin, HIGH); 
} 
 

Description   The pulseIn() method returns the length in microseconds on a digital input pin for a short period of time from 10 milliseconds to 3 minutes. It can be used to read sensors that return a pulse train like some accelerometers or rangers. The user can specify the counting on HIGH or LOW transitions. The pulseIn command stops all activity while executing. A timeout of 1 second (1000000 microseconds) prevents the command to wait forever. A specific timeout in microseconds can also be specified.

pulseIn() 메소드는 디지털 입력 핀에 가해지는 3밀리 초 부터 3 분 까지의 짧은 기간의 펄스 길이를 마이크로 초 단위의 숫자로 반환합니다. 가속도 센서나 길이측정 센서의 출력 펄스를 읽을 때 사용할 수 있습니다.  pulseIn 커맨드가 실행될 때  모든 동작을 중지 합니다. 타임아웃을 1 초로 설정하면 무한 실행을 멈출 수 있습니다. 타임 아웃 지정은 마이크로 초 단위로 설정 할 수 있습니다. 

   
Syntax  
pulseIn(pin,transition)
pulseIn(pin,transition,timeout)
   
Parameters  
pin   int: the pin used for reading the pulse

transition   HIGH or LOW

timeout   int: a timeout value in microseconds

   
Returns   int
   
Usage   Application