매개변수에 지정된 시간(마이크로 초)동안 프로그램을 멈춘다. 1밀리초는 1000 마이크로 초, 1초는 100만 마이크로 초.
현재, 정확한 delay를 만드는 가장 큰 값은 16383. 미래의 아두이노 릴리스에서 바뀔 수 있다. delay 가 몇 천 마이크로 초 보다 길면, 대신 delay() 를 써야 한다.
문법
delayMicroseconds(us)
매개변수
us: 멈출 마이크로 초 (unsigned int)
반환
없음
예제 코드
이 코드는 핀번호 8이 출력 핀으로 동작하도록 구성한다. 약 100 마이크로 초의 펄스 열을 보낸다. 근사값은 코드에서 다른 명령 실행으로 인한 것이다.
int outPin = 8; // 디지털 핀 8
void setup() {
pinMode(outPin, OUTPUT); // 디지털 핀을 출력으로
}
void loop() {
digitalWrite(outPin, HIGH); // 핀을 켠다
delayMicroseconds(50); // 50 마이크로 초 쉰다
digitalWrite(outPin, LOW); // 핀을 끈다
delayMicroseconds(50); // 50 마이크로 초 쉰다
}
주의와 경고
이 함수는 3 마이크로 초 이상 범위에서 매우 정확하게 돌아간다. delayMicroseconds 가 작은 지연시간동안 정확히 수행한다고 보장할 수 없다.
아두이노 0018 현재, delayMicroseconds() 는 더이상 인터럽트를 비활성화 하지 않는다.
See also
Title
Arduino Newsletter
We care about the privacy and personal data of our users.
To continue, please give us your consent:
Please confirm that you have read the privacy policy
Thank you for subscribing!
Curious to learn more?
Are you also a teacher, student, or professional that loves using Arduino in your day-to-day activities?
Then keep up-to-date with either our STEM or Professional monthly newsletters.
Arduino weekly newsletter (already subscribed)
Educators can benefit from the ever growing tech that shapes our environment through fun cool projects.
Why not awe your boss with highly innovative ways to help keep your enterprise connected at no extra cost?
Arduino Survey
We'd like to get to know you little better.
Please help us improve by answering this super short optional survey.