전자/참조(Reference)
FUNCTIONS : micros()
KiwiPedia
2019. 2. 8. 17:02
설명(Description)
Arduino 보드가 현재 프로그램을 실행한 후 마이크로 초를 반환합니다. 이 숫자는 약 70분 후에 오버플로합니다.(0으로 되돌아갑니다.) 16MHz Arduino 보드에서이 함수의 분해능은 4마이크로 초입니다(즉 반환 된 값은 항상 4의 배수 임). 8MHz Arduino 보드에서이 기능의 분해능은 8마이크로 초입니다.
문법(Syntax)
time = micros()
파라미터(Parameters)
없음.
반환(Returns)
Arduino 보드 실행 한 후 us 수 (unsigned long)
예제 코드(Example Code)
이 코드는 Arduino 보드가 시작된 이후 us(microseconds)를 반환합니다.
unsigned long time; void setup(){ Serial.begin(9600); } void loop(){ Serial.print("Time: "); time = micros(); Serial.println(time); //prints time since program started delay(1000); // wait a second so as not to send massive amounts of data }
메모 및 주의(Notes and Warnings)
1,000us(microseconds)는 1ms(milliseconds)이고, 1,000,000us(microseconds)는 1s(seconds)입니다.