micros()

C 에디터 명령어 ›› Time ››
Parent Previous Next

현재 프로그램이 시작된 이후로 경과된 시간을 마이크로초 단위로 반환합니다.

이 값은 약 70분 후에 오버플로우로 인해 0으로 돌아갑니다.

측정 가능한 최소 시간은 4 마이크로초입니다.


사용방법

micros()


리턴값

unsigned long


예제 코드

unsigned long time;


void setup(){

 Serial.begin(9600);

}

void loop(){

 Serial.print("Time: ");

 time = micros();

 //프로그램 시작 이후 지난 시간을 표시

 Serial.println(time);

 // 너무 많은 데이터를 전송하지 않도록 1초 대기

 delay(1000);

}


참고사항

1초 = 1,000밀리초 = 1,000,000마이크로초

Created with the Personal Edition of HelpNDoc: News and information about help authoring tools and software