此函數用於返回的Arduino板開始運行當前程序時的毫秒數。這個數字在大約50天后溢出,即回到零。
善於使用millis
能使Arduino實行多線程
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);
}