目录

millis () function

此函数用于返回当时的毫秒数,Arduino板开始运行当前程序。 这个数字溢出,即大约50天后回到零。

millis() function Syntax

millis () ;

此函数返回从程序开始的毫秒数。

例子 (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); 
}
↑回到顶部↑
WIKI教程 @2018