跳转到主要内容

Time

Time

This library waits for and/or measures the specified time.

millis

Description
Returns the number of milliseconds since the GR-ROSE board began running the current program. This number will overflow (go back to zero), after approximately 50 days.
Syntax
unsigned long millis()
Parameters
None
Returns
Number of milliseconds since the program started (unsigned long)

micros

Description
Returns the number of microseconds since the GR-ROSE board began running the current program. This number will overflow (go back to zero), after approximately 70 minutes.
Syntax
unsigned long micros()
Parameters
None
Returns
Number of microseconds since the program started (unsigned long)

delay

Description
Pauses the program for the amount of time (in milliseconds) specified as parameter.
Syntax
delay(unsigned long ms)
Parameters
ms: The number of milliseconds to pause
Returns
None
Notes
Task switching is performed because the FreeRTOS vTaskDelay is used.

delayMicroseconds

Description
Pauses the program for the amount of time (in microseconds) specified as parameter.
Syntax
delayMicroseconds(unsigned long us)
Parameters
us: The number of microseconds to pause
Returns
None
Notes
Unlike with delay, task switching is not performed during stop because FreeRTOS vTaskDelay is not used.

Sample Program

Displays the time since program start in 100ms intervals via serial communications.


#include <Arduino.h>
#define INTERVAL 100
unsigned long val_time;
 
void setup()
{
    Serial.begin(9600);
}
 
void loop()
{
    val_time = millis();
    Serial.println( val_time );
    delay(INTERVAL);
}

支持

支持社区

支持社区

在线询问瑞萨电子工程社群的技术人员,快速获得技术支持。
浏览常见问题解答

常见问题

浏览我们的知识库,了解常见问题的解答。
提交工单

提交工单

需要咨询技术性问题或提供非公开信息吗?