블로그 이미지
래머
오늘도 열심히 개발하는 개발자입니다.

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Notice

2015. 5. 2. 15:56 아두이노

http://www.arduino.cc/en/Reference/Millis

millis()

Description

Returns the number of milliseconds since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 50 days.

아두이노가 현재의 프로그램을 시작한 시점으로 부터 경과한 밀리초 단위의 시간을 리턴한다.

이값은 대략 50일 후에 오버플로될것이다(0으로 돌아간다).

Parameters

None

Returns

Number of milliseconds since the program started (unsigned long)

프로그램이 시작된 후 부터 경과한 밀리초 단위 시간

Example

unsigned long time;

void setup(){
  Serial.begin(9600);
}
void loop(){
  Serial.print("Time: ");
  time = millis();
  //prints time since program started
  Serial.println(time);
  // wait a second so as not to send massive amounts of data
  delay(1000);
}

Tip:

Note that the parameter for millis is an unsigned long, errors may be generated if a programmer tries to do math with other datatypes such as ints.

주의할점은 파라메터의 타입이 unsigned long형이므로, 프로그래머가 ints형과 같은 변수들로 연산을 시도할 경우 오류가 발생할 수 있다.

See also

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

'아두이노' 카테고리의 다른 글

아두이노 심플파서  (0) 2015.05.03
아두이노 delay() 함수  (0) 2015.05.02
SPI library  (0) 2015.02.23
HC-06 블루투스 모듈  (0) 2015.02.09
아두이노 타이머 인터럽트의 주의점 #3  (0) 2015.02.09
posted by 래머