Skip to content

Commit ca3cdc2

Browse files
added example how to get rtc counters
1 parent 8d7fb22 commit ca3cdc2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include "Arduino.h"
2+
#include "soc/rtc.h"
3+
4+
/*rtc_time_get() return the RTC counters
5+
* the board using internal 150KHz RTC, but it's not accurate.
6+
*/
7+
void setup() {
8+
// put your setup code here, to run once:
9+
Serial.begin(115200);
10+
}
11+
12+
void loop() {
13+
uint64_t rtc_counter1 = rtc_time_get();
14+
delay(1000);
15+
uint64_t rtc_counter2 = rtc_time_get();
16+
17+
Serial.println((uint32_t)(rtc_counter2-rtc_counter1));
18+
}

0 commit comments

Comments
 (0)