File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Firmware/Test Sketches/Idle_Loop Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments