Arduino millis()函数
此函数用于返回的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);
}