// throttled loop demo
// https://forum.arduino.cc/t/how-should-one-go-about-creating-an-arduino-timer-split-in-sections-with-random-interruptions-based-on-certain-conditions/1108459
// https://wokwi.com/projects/360724336611296257
void setup() {
Serial.begin(115200);
Serial.println("Throttled Loop World!\n");
}
const byte RATE = 777; // slow and easy demo
void loop() {
static unsigned long lastLoopTime;
unsigned long now = millis();
if (now - lastLoopTime > 777) {
// code inside this block will only run every RATE milliseconds
lastLoopTime = now;
Serial.print("I have been awake for ");
Serial.print(millis());
Serial.print(" milliseconds");
Serial.println();
}
// loop runs at full speed in this area
} // loop()