Skip to content

Commit fd09046

Browse files
authored
Merge pull request #224 from LeeLeahy2/idle-test-sketch
Test sketch for idle count
2 parents b44f89c + a46ec18 commit fd09046

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
Idle loop
3+
By: Lee Leahy
4+
SparkFun Electronics
5+
Date: July 9th, 2022
6+
License: MIT. See license file for more information but you can
7+
basically do whatever you want with this code.
8+
9+
This example determines the count for the idle loop
10+
*/
11+
12+
#define testTimeSecs (3 * 60)
13+
14+
uint32_t startTime;
15+
uint32_t idleCount;
16+
17+
void setup()
18+
{
19+
Serial.begin(115200);
20+
idleCount = 0;
21+
startTime = millis();
22+
}
23+
24+
void loop()
25+
{
26+
//Query module only every second.
27+
//The module only responds when a new position is available.
28+
while ((millis() - startTime) < (testTimeSecs * 1000))
29+
{
30+
idleCount++;
31+
yield();
32+
}
33+
34+
//Display the idle count
35+
Serial.printf("Count / Second = %d\r\n", idleCount / testTimeSecs);
36+
37+
//Done
38+
while(1)
39+
delay(1000);
40+
}

0 commit comments

Comments
 (0)